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 />

“Anonymous Functions” on page 4-3 explains how to create anonymous<br />

functions.<br />

If you later decide to find a zero for different values <strong>of</strong> b and c, you must<br />

redefine the anonymous function using the new values. For example,<br />

b = 4;<br />

c = -1;<br />

fzero(@(x) poly(x, b, c), 0)<br />

ans =<br />

0.2463<br />

For more complicated objective functions, it is usually preferable to write the<br />

function as a nested function, as described in “Providing Parameter Values<br />

Using Nested Functions” on page 4-30.<br />

4-32

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

Saved successfully!

Ooh no, something went wrong!