Appendix B
This appendix lists the plotting routines in MATLAB with a brief description and example. To save space, some entries show a single encompassing example for multiple commands. An example may also use an ellipsis (...) to show the continuation of a pattern. To assist you, we have included several functions to generate test matrices, for example, rand(), magic(), peaks(), cylinder(), ellipsoid(), and sphere().
Table B1 Basic Plotting Routines
Routine 
Description 
Example 
ezplot 
Plots the expression enclosed in quotes 
ezplot('exp(0.4*x)*sin(x)') 
fplot 
Same as ezplot, but requires limits 
fplot('exp(0.4*x)*sin(x)',[0,2*pi,0.3,0.6]) 
plot 
Plots data passed in by vectors 
x=[0:2*pi/100:2*pi]; y=exp(0.4*x).*sin(x); plot(x,y); figure(2) comet(x,y); figure(3) ribbon(x,y);figure(4) y2=100*exp(0.4*x).*cos(x); plotyy(x,y,x,y2) 
comet 
Just like plot, but comet animates the trajectory. It helps to have a larger vector to slow down the comet trace a tad  
ribbon 
Like plot, but it displays the data as 3D ribbons  
plotyy 
Plots data where y values may differ greatly — it makes two yaxes 

loglog 
Plots data on a log scale on both x and yaxes — y proportional to a power of x is straight on this plot 
x=[0:2*pi/100:2*pi]; y=10*x.^pi; loglog(x,y) 
semilogx 
Xaxis data is on a log scale and the yaxis is on a linear scale — y linearly related to log(x) is straight on this plot 
x=[0:2*pi/100:2*pi]; y=10*log(x)+pi; ... 
No credit card required