您好,欢迎访问三七文档
当前位置:首页 > 财经/贸易 > 资产评估/会计 > matlab阻尼牛顿法例题
UsedampedNewtonmethodtofindtheminimumof.Selectsuitableinitialpoint.Stoppingerrorshouldnotlargerthan=0.01.Requirements:(1)WriteMatlabcodestofinishthealgorithm(notuseMatlabfunctiondirectly).(2)ProvideMatlabcodes,themiddleandthefinalresults.MatlabCodes:symsx1x2x3n;x=[x1,x2,x3]';f=x1^2+4*x2^2+9*x3^2-2*x1+18*x3;g=[2*x1-2,8*x2,18*x3+18]';h=[2,0,0;0,8,0;0,0,18];h0=inv(h);eps=0.01;k=0;tol=1;x0=[0,0,0]';whiletolepsg0=subs(g,x,x0);m=eval(norm(g0));ifmepsminf=subs(f,{x1,x2,x3},{x0(1,1),x0(2,1),x0(3,1)})x=x0breakelsed0=-h0*g0;fn=subs(f,x,x0);dfn=diff(fn);n0=solve(dfn);[r,s]=size(n0);d2fn=diff(fn,2);fori=1:sl(i)=limit(d2fn,n,n0(i));temp=double(l(i));iftemp0n=n0;end;end;end;x0=x0+n*d0;tol=m;k=k+1endResult:k=0g0=-2m=18.1108018k=1g0=0m=0fmin=-10x=1000-1
本文标题:matlab阻尼牛顿法例题
链接地址:https://www.777doc.com/doc-4101242 .html