Thursday, June 9, 2011

Simple Plots in Matlab

Simple Plots in Matlab

This is a continuation of the earlier post Matlab Basics
Creating Plots in Matlab is probably the easiest in all possible options present in the Software Universe. We shall study only the most basic methods in this Post and then advance to comparatively complex features.

Create a Vector for representing the X - Axis
>> x=[-2*pi:.001:2*pi];
>>
>> y=sin(x);
>> plot(x,y)
>> 




>> plot(cos(x),sin(x))
>>

 


 
>> plot(cos(x),sin(x).*cos(x))
>> 
%Remember the .* represents the dot product, and is necessary because all variables in Matlab are vectors and by default it will try to multiply them as matrices.


Next, we shall advance to more complex formatting of Plots, and then 3D plots.


No comments:

Post a Comment