next up previous contents
Next: 2.1.3.7 Contour plots Up: 2.1.3 Other 2-D plots Previous: 2.1.3.5 Scatter Plots   Contents

2.1.3.6 Function plots

If you just want to plot a function, say $y=e^x$, and you are too lazy to define two arrays of $x$ and $y$ values, there's a shorter way.
% Lazy plotting 
close all; clear all;
ezplot('exp(x)')
Here are some more.
% More lazy plotting
close all; clear all;
figure(1) % Make multiple plot windows, start with #1 
ezplot('exp(x)',[0 1]) % The second argument defines the x range
figure(2) % Open a second plot window
ezplot('x^2+y^2=1') % Notice the "implicit" definition of y=f(x)
figure(3) % Open yet another figure window
F='1+3*cos(2*theta)'; % Define a function to be plotted
ezplot(F) % Notice how nicely the plot and x-axis are labeled
Some other ``ez'' versions of MATLAB's plotting commands are ezpolar, ezplot3d, ezcontour, and ezsurf.

Gus Hart 2005-01-28