0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

Matlab: Graph Plots

3,427

Published on

Plotting using Matlab

Plotting using Matlab

Published in: Technology
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

Views
Total Views
3,427
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
0
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript

• 1. Matlab: Graph Plots
• 2. Tools for plotting
plot- plot(y) plots the values in vector y versus their index.  plot(x,y) plots the values in vector y versus x. The plot function produces a piecewise linear graph between its data values. With enough data points it looks continuous.
stem- Using stem(y) the data sequence y is plotted as stems from the x-axis terminated with circles for the data values. stem(x,y) plots the data sequence y at the values specified in x.
• 3. Tools for plotting
xlabel(&apos;string&apos;) - Labels the x-axis with string.
ylabel(&apos;string&apos;) - Labels the y-axis with string.
title(&apos;string&apos;) - Gives the plot the title string.
• 4. Tools for plotting
hold on / off - Normally hold is off. This means that the plot command replaces the current plot with the new one. To add a new plot to an existing graph use hold on. If you want to overwrite the current plot again, use hold off.
legend(&apos;plot1&apos;,&apos;plot2&apos;,...,&apos;plot N&apos;) - The legend command provides an easy way to identify individual plots when there are more than one per figure.
axis([xminxmaxyminymax])- Use the axis command to set the axis as you wish.
• 5. Tools for plotting
subplot(m,n,p) -Divides the figure window into m rows, n columns and selects the pp&apos;th subplot as the current plot, e.g subplot(2,1,1) divides the figure in two and selects the upper part. subplot(2,1,2) selects the lower part.
grid on/off - This command adds or removes a rectangular grid to your plot.
• 6. Graph Components
The following picture shows the basic components of a typical graph.
• 7. 2-D plotting
To plot the function:
y = x2 for x 2 [-2; 2].
• 2-D plotting
• 2-D plotting
• t = 0:pi/20:2*pi;
• 27. y = exp(sin(t));
• 28. plotyy(t,y,t,y,'plot','stem')
• 29. xlabel('X Axis')
• 30. ylabel('Plot Y Axis')
• 31. title('Two Y Axes')
• 3-D Graphics
• Visit more self help tutorials
Pick a tutorial of your choice and browse through it at your own pace.
The tutorials section is free, self-guiding and will not involve any additional support.
Visit us at www.dataminingtools.net