搜索内容 搜索用户

# 5 麦片

050

13主题 0最佳答案

 function f=myyz( x ) t=1:8; y(t)=x(t);z(t)=x(t+8); for i=2:8;%        for j=1:i-1     h(j)=sin(y(j)+z(j)-1.5)/(sin(y(j)+z(j))*sin(z(j+1)-1.5))*sin(z(i));     u=prod(h)     end g(i)=(sin(y(i-1)-z(i)+z(i-1))/sin(z(i-1)-1.5)+sin(y(i))/sin(y(i)+z(i)))*u; f=sum(g)*0.92*0.73; end复制代码x0=zeros(16,1) A=[-1,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0;    0,-1,0,0,0,0,0,0,0,0,-1,1,0,0,0,0;    0,0,-1,0,0,0,0,0,0,0,0,-1,1,0,0,0;    0,0,0,-1,0,0,0,0,0,0,0,0,-1,1,0,0;    0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,1,0;    0,0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,1;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] b=zeros(16,1) Aeq=[1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0] beq=pi lb=zeros(16,1) ub=[pi;pi;pi;pi;pi;pi;pi;pi;pi;pi;pi;pi;pi;pi;pi;pi] [x,fval]=fmincon(@myyz,x0,A,b,Aeq,beq,lb,ub);复制代码

# 9190 麦片

11主题 1996最佳答案
• 关注者： 591

 看看u，得到的好多都是NaN和inf

# 5 麦片

050

13主题 0最佳答案
楼主| 发表于 2018-1-26 21:42:00 | 显示全部楼层
 对，我运行出来也是，能看看我的图片上的公式吗

# 5 麦片

050

13主题 0最佳答案
楼主| 发表于 2018-1-26 21:45:03 | 显示全部楼层
 u计算后面一节连乘

# 5 麦片

050

13主题 0最佳答案
楼主| 发表于 2018-1-26 22:37:58 | 显示全部楼层
 我每运行一次，值都不一样，而且跨度很大

 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页