全文预览

优化方法MATLAB编程大连理工大学

上传者:读书之乐 |  格式:doc  |  页数:17 |  大小:497KB

文档介绍
;Р H=H0+(miu*dete_x*dete_x'-H0*dete_g*dete_x'-dete_x*dete_g'*H0)/(dete_x'*dete_g);Р s=-H*g(x);Р x0=x;Р s0=s;Р H0=H;Р g0=g(x);Р k=k+1;Р endРendРzy_x=x;Рzyj=f(x);Рfprintf('after %d iterations,obtain the optimal solution.\n\nThe optimal solution is %f.\n\n The optimal "x" is "ans".\n',k,zyj);Р Р Р Р Рfunction f=f(x)Рx1=[1 0 0 0]*x;Рx2=[0 1 0 0]*x;Рx3=[0 0 1 0]*x;Рx4=[0 0 0 1]*x;Рf=(x1-1)^2+(x3-1)^2+100*(x2-x1^2)^2+100*(x4-x3^2)^2;Рfunction g=g(x)Рx1=[1 0 0 0]*x;Рx2=[0 1 0 0]*x;Рx3=[0 0 1 0]*x;Рx4=[0 0 0 1]*x;Рg=[2*(x1-1)-400*x1*(x2-x1^2);200*(x2-x1^2);2*(x3-1)-400*x3*(x4-x3^2);200*(x4-x3^2)];Р代入初始值,计算结果如下:Р>> x=[-1.2 1 -1.2 1]';Р>> di2tiBFGS(x)Рafter 53 iterations,obtain the optimal solution.РThe optimal solution is 0.000000.Р The optimal "x" is "ans".Рans =Р 1.0000Р 1.0000Р 1.0000Р1.0000Р第三题

收藏

分享

举报
下载此文档