15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4 Function Functions<br />

25<br />

20<br />

15<br />

10<br />

5<br />

0<br />

−5<br />

−10<br />

−5 −4 −3 −2 −1 0 1 2 3 4 5<br />

You can also pass the function handle for an anonymous function for fplot to<br />

graph, as in<br />

fplot(@(x)2*sin(x+3),[-1 1]);<br />

You can plot more than one function on the same graph with one call to fplot.<br />

If you use this with a function, then the function must take a column vector x<br />

and return a matrix where each column corresponds to each function,<br />

evaluated at each value <strong>of</strong> x.<br />

If you pass an anonymous function consisting <strong>of</strong> several functions to fplot, the<br />

anonymous function also must return a matrix where each column corresponds<br />

to each function evaluated at each value <strong>of</strong> x, as in<br />

fplot(@(x)[2*sin(x+3), humps(x)],[-5 5])<br />

which plots the first and second functions on the same graph.<br />

4-6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!