正在加载图片...
Figure 1: Example of the plotting of the function s(t)=te- cos(2T 4t) Type help print' to see additional options 6.4 Diary Files A written record of a MATLAB session can be kept with the diary command and saved in a diary file. To start recording a diary file during a matlab session and to save it in filename, ty > diary filename o end the recording of information and to close the file type > diary off 7 Plotting MATLAB contains numerous commands for creating two- and three-dimensional plots. The most basic of these commands is 'plot' which can have multiple optional arguments. A simple example of this command is to plot a function of time t=linspace(0, 8, 401); 7Define a vector of times from o to 8 s with 401 x= t *exp(-t)*cos(2*pi*4*t); 7Define a vector of x values plot(t, x) %Plot x1abel(Time(s)’); ZLabel time axis label('Amplitude) ZLabel amplitude axis This script yields the plot shown in Figure 1Amplitude 0.4 0.3 0.2 0.1 0 Figure 1: Example of the plotting of the function x(t) = te−t -0.1 cos(2π4t). -0.2 -0.3 -0.4 0 1 2 3 4 5 6 7 8 Time (s) Type ‘help print’ to see additional options. 6.4 Diary Files A written record of a MATLAB session can be kept with the diary command and saved in a diary file. To start recording a diary file during a MATLAB session and to save it in filename, type >> diary filename To end the recording of information and to close the file type >> diary off 7 Plotting MATLAB contains numerous commands for creating two- and three-dimensional plots. The most basic of these commands is ‘plot’ which can have multiple optional arguments. A simple example of this command is to plot a function of time. t = linspace(0, 8, 401); %Define a vector of times from ... 0 to 8 s with 401 points x = t.*exp(-t).*cos(2*pi*4*t); %Define a vector of x values plot(t,x); %Plot x vs t xlabel(’Time (s)’); %Label time axis ylabel(’Amplitude’); %Label amplitude axis This script yields the plot shown in Figure 1. 10
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有