Upcoming SlideShare
×

Like this presentation? Why not share!

# Matlab graphics

## on Apr 29, 2012

• 336 views

### Views

Total Views
336
Views on SlideShare
336
Embed Views
0

Likes
0
6
0

No embeds

### Report content

• Comment goes here.
Are you sure you want to

## Matlab graphicsPresentation Transcript

• MATLAB GRAPHICS
• PHILOSOPHYA picture, it is said, is worth a thousand words.Graphics ki duniyan me swagat hai!!!!Hum log 2d 3d plots ki kuch jankari lene ki koshish karengePer for further information u shud chk the help part in MATLAB
• Basic 2d graphicsTry thisplot(rand(1,20))Most common format is plot(x,y) where x and y are nothing butVectors of same length.Axes are automatically scaled and drawn to include theminimum and maximum data points.Eg of vectors of same length:x = 0:pi/40:4*pi;plot(x, sin(x))
• Another form of plot to draw a line between two points:coordinates (0, 1) and (4, 3)plot([0 4], [1 3])Also has set of easy to use plot commands called ezplotEg ezplot(‘tan(x)’) ezplot(‘cos(x)) ezplot(‘x^2’)
• Labelsgtext(‘x marks the spot’)Try with me!Try to explore figure menus like insertgridtitle(’text’)xlabel(’horizontal’)ylabel(’vertical’)
• Multiple plots on same axis:holdplot(rand(1,20))plot(rand(1,17))hold offIf you are plotting two graphs on the same axes you may findplotyy useful—it allows you to have independent y-axis labelson the left and the right, e.g.plotyy(x,sin(x), x, 10*cos(x))(for x suitably defined).
• plot(0, 0, o) plot(x,sin(x), x, cos(x), ‘m’) plots sin (x) in the default style and color and cos (x) with circles joined with dashes in magenta. The available colors are denoted by the symbols c, m, y,k, r, g, b, w. You can have fun trying to figure out what they mean, or you can use help plot to see the full range of possible symbols.
• Axis limitsaxis( [xmin, xmax, ymin, ymax] )Go home try to find out on internet abt other axis commandsMultiple plots in figure
• Logarithmic plots: x = 0:.01:4; semilogy(x, exp(x)), gridTry to find out info on semilogxPolar plotspolar(theta, r)x = 0:pi/40:2*pi;polar(x, sin(2*x)),grid
• Plotting rapidly changing mathematical functionx = 0.01:.001:.1;plot(x, sin(1./x)).001 ki jagah .0001 daliye graphs significantly alag haiInstead of this use fplotfplot(sin(1/x), [0.01 0.1])
• 3 d plotsplot3(x, y, z) draws a 2-D projection of a line in 3-D through the points whose coordinates are the elements of the vectors x, y and z. For example, the command z-axisplot3(rand(1,10), rand(1,10), rand(1,10))generates 10 random points in 3-D space, and joins them withLines.
• Mesh surfacesz =x^2 –y^20<=x<=5 and 0<=y<=5[x,y] =meshgrid(0:5)z = x.^2 - y.^2mesh(x,y,z)Now typesurf(x,y,z)See what happens