Matlab's plotting capabilities are easy to use. (Type help plot for some information.) For example, to view a graph of
x = -1:0.05:2; y = exp(x.^2) + cos(pi*x); plot(x, y);The first line creates a vector (or list of numbers) x ranging from -1 to 2 in increments of 0.05. The second statement loads the vector y with a list of values of
.^
to indicate that corresponding entries in x multiply each
other. Analogous operations are .* and ./ for
entry-by-entry multiplication and division. When in doubt, use
.*, ./, and .^
)
To print a graph, use the Print command under the figure's File menu.
Next: Plot a solution and a forcing function on the same graph
© 1996 by Will Brother. All rights Reserved. File last modified on November 21, 1996.