实验七 无约束优化

发布时间 : 星期五 文章实验七 无约束优化更新完毕开始阅读

f(33)=(x(1,18)-x(1,9))^2+(x(2,18)-x(2,9))^2-d(33)^2; f(34)=(x(1,19)-x(1,9))^2+(x(2,19)-x(2,9))^2-d(34)^2; f(35)=(x(1,21)-x(1,9))^2+(x(2,21)-x(2,9))^2-d(35)^2; f(36)=(x(1,17)-x(1,10))^2+(x(2,17)-x(2,10))^2-d(36)^2; f(37)=(x(1,24)-x(1,10))^2+(x(2,24)-x(2,10))^2-d(37)^2; f(38)=(x(1,14)-x(1,11))^2+(x(2,14)-x(2,11))^2-d(38)^2; f(39)=(x(1,16)-x(1,11))^2+(x(2,16)-x(2,11))^2-d(39)^2; f(40)=(x(1,14)-x(1,12))^2+(x(2,14)-x(2,12))^2-d(40)^2; f(41)=(x(1,18)-x(1,12))^2+(x(2,18)-x(2,12))^2-d(41)^2; f(42)=(x(1,14)-x(1,13))^2+(x(2,14)-x(2,13))^2-d(42)^2; f(43)=(x(1,15)-x(1,13))^2+(x(2,15)-x(2,13))^2-d(43)^2; f(44)=(x(1,19)-x(1,15))^2+(x(2,19)-x(2,15))^2-d(44)^2; f(45)=(x(1,22)-x(1,15))^2+(x(2,22)-x(2,15))^2-d(45)^2; f(46)=(x(1,17)-x(1,16))^2+(x(2,17)-x(2,16))^2-d(46)^2; f(47)=(x(1,18)-x(1,16))^2+(x(2,18)-x(2,16))^2-d(47)^2; f(48)=(x(1,19)-x(1,18))^2+(x(2,19)-x(2,18))^2-d(48)^2; f(49)=(x(1,22)-x(1,18))^2+(x(2,22)-x(2,18))^2-d(49)^2; f(50)=(x(1,23)-x(1,18))^2+(x(2,23)-x(2,18))^2-d(50)^2; f(51)=(x(1,22)-x(1,20))^2+(x(2,22)-x(2,20))^2-d(51)^2; f(52)=(x(1,22)-x(1,21))^2+(x(2,22)-x(2,21))^2-d(52)^2; x0=[ones(1,24);zeros(1,24)];

d=[0.9607,0.4399,0.8143,1.3765,1.2722,0.5294,0.6144,0.3766,0.6893,...

0.9488,0.8000,1.1090,1.1432,0.4758,1.3402,0.7006,0.4945,1.0559,... 0.6810,0.3587,0.3351,0.2878,1.1346,0.3870,0.7511,0.4439,0.8363,... 0.3208,0.1574,1.2736,0.5781,0.9254,0.6401,0.2467,0.4727,1.3840,... 0.4366,1.0307,1.3904,0.5725,0.7660,0.4394,1.0952,1.0422,1.8255,... 1.4325,1.0851,0.4995,1.2277,1.1271,0.7060,0.8052]'; [x,norms]=lsqnonlin(@dis,x0,[],[],[],d); X=[0,x(1,:)]; Y=[0,x(2,:)]; plot(X,Y,'+')

第六题:

6. function f=shiyan0706(x) i=1:33;

y=[0.844 0.908 0.932 0.936 0.925 0.908 0.881 0.850 0.818 0.784 0.751...

0.718 0.685 0.658 0.628 0.603 0.580 0.558 0.538 0.522 0.506 0.490...

0.478 0.467 0.457 0.448 0.438 0.431 0.424 0.420 0.414 0.411 0.406];

t=10*(i-1);

f=y-x(1)+x(2)*exp(-x(4)*t)+x(3)*exp(-x(5)*t); Ex0706

x0=[0.5 1.5 -1 0.01 0.02];

opt1=optimset('LargeScale','off','MaxFunEvals',1000); [x,norm1,res1,exit1,out1]=lsqnonlin('shiyan0706',x0,[],[],opt1) opt2=optimset(opt1,'LevenbergMarquardt','off');

[x,norm2,res2,exit2,out2]=lsqnonlin('shiyan0706',x0,[],[],opt2) >> ex0706

Maximum number of function evaluations exceeded. Increase OPTIONS.MaxFunEvals.

x =

0.3334 -0.4292 -0.2246 0.0057 0.0062

norm1 =

0.1698 res1 =

Columns 1 through 8

-0.1459 -0.0454 0.0771 0.0758 0.0687

Columns 9 through 16

0.0590 0.0459 -0.0094 -0.0245 -0.0355

Columns 17 through 24

-0.0454 -0.0550 -0.0808 -0.0837 -0.0862

0.0125 0.0324 -0.0635 0.0482 0.0176 -0.0686 0.0666 0.0016 -0.0744

联系合同范文客服:xxxxx#qq.com(#替换为@)