optimization - fprintf('\ny...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function optimization %Problem 14.12 %options =optimset('Display','iter'); x=[.1 .2 .4 .6 .9 1.3 1.5 1.7 1.8]'; y=[0.75 1.25 1.45 1.25 .85 .55 .35 .28 .18]'; plot(x,y,'o'); hold on ao=[0.3 0.4]'; A=lsqnonlin(@myfun,ao); F=A(1).*x.*exp(A(2)*x); plot(x,F,'g');
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fprintf('\ny =%5.4fxe^(%5.4fx)\n\n',A(1),A(2)); hold off function F=myfun(A) %problem 14.12 continued x=[.1 .2 .4 .6 .9 1.3 1.5 1.7 1.8]'; y=[0.75 1.25 1.45 1.25 .85 .55 .35 .28 .18]'; F=y-A(1).*x.*exp(A(2)*x);...
View Full Document

Ask a homework question - tutors are online