Basic Plotting
Matlab provides a number of options for plotting viz. 2-D
plotting, 3-D plotting, Line plots, polar plots, charts, etc. Discussion of
most of the plots will be discussed step by step.
Let us start discussing with the 2-D plot
>> t=0:0.01:1;
>> a= sin(2*pi*t);
>> plot(t,a)
Use of ‘linspace’ function
In some applications, we require the plot that serves our
purpose only i.e. only a required range of the output from the function. The
following example gives the idea about it.
>> x = linspace(-2*pi,2*pi);
>> a= sin(x);
>> plot(x,a)
Plotting multiple plots
in one plot
To use this feature of the Matlab, the same plotting function
of Matlab is used, which is used for plotting one plot. But the only difference
is that you need to add the parameters of the second plot append to the first
plot parameter. See the example below:
>> t=0:0.01:1;
>> y1 = sin(2*pi*t);
>> y2 = cos(2*pi*t);
>> plot(t,y1,t,y2)



No comments:
Post a Comment