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

Plotting the Results<br />

To plot the fit and the data, enter the following commands.<br />

plot(xdata, ydata, '*')<br />

hold on<br />

[sse, FittedCurve] = model(estimates);<br />

plot(xdata, FittedCurve, 'r')<br />

xlabel('xdata')<br />

ylabel('f(estimates,xdata)')<br />

title(['Fitting to function ', func2str(model)]);<br />

legend('data', ['fit using ', func2str(model)])<br />

hold <strong>of</strong>f<br />

The resulting plot displays the data points and the exponential fit.<br />

45<br />

40<br />

Fitting to function fitcurvedemo/expfun<br />

data<br />

fit using fitcurvedemo/expfun<br />

35<br />

30<br />

f(estimates,xdata)<br />

25<br />

20<br />

15<br />

10<br />

5<br />

0<br />

−5<br />

0 2 4 6 8 10<br />

xdata<br />

4-12

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

Saved successfully!

Ooh no, something went wrong!