Thursday 8 December 2011

Matlab plot tips and tricks,Matlab Plot with Color and Line width

MATLAB plotting commands are best show by example. I have used to make the examples compact, while avoiding the insignificant. The examples build on each other so it is advisable to at least read quickly through the presentation in order. In Matlab plotting has more types and more properties are there. This properties are differ in different Matlab versions.

Plot(xdata,ydata) %normal plot in matlab


Matlab has a lot of parameters with plot. that properties are
  1. Xdata
  2. Ydata
  3. Outliers
  4. OutlierLineSpec and etc
Example as follows,

>> xdata = [1 2 3 4 5];
>> ydata = [6 7 8 9 10];
>> plot(xdata,ydata);


This plot is normal plot of line. if you have set any color and any properties then you use single quotes and use their properties and values .In below example shows a matlab plot with color and line width and set grid option.
>>x = -pi:.1:pi;
>>y = sin(x);
>>plot(x,y,'color','red','LineWidth',2)
>>grid on %set a grid on figure




Matlab Plot 3D:

Matlab 3D plot as follow example.

>> t = 0:pi/50:10*pi;
>>plot3(sin(t),cos(t),t)
>>grid on % show the grid option on figure
>>axis square %set access as square shape



Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...