找回密码
 注册
Simdroid-非首页
查看: 106|回复: 2

已解决,matlab约束优化问题

[复制链接]
发表于 2010-5-4 12:46:22 | 显示全部楼层 |阅读模式 来自 辽宁沈阳
本帖最后由 diu99 于 2010-5-4 23:14 编辑

使用fmincon和fminimax都出现Too many output arguments.的问题不知如何解决,恳请请高手帮一下忙,原文件已上传,谢谢!!!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
发表于 2010-5-4 17:12:15 | 显示全部楼层 来自 浙江杭州
Simdroid开发平台
没几行的代码,贴出来就可以了,做成附件,大家看着麻烦。

opf.m

  1. function opf(x)
  2. y=-(15.92*x(4) - 6.274*x(8) + 17.14*x(1) - 5.233*x(5) + 23.18*x(2) - 5.896*x(6) + 17.3*x(3) - 4.765*x(7) + 0.6862*x(4)*x(8) + 0.5753*x(1)*x(5) + 0.6436*x(2)*x(6) + 0.6058*x(3)*x(7) + (8.753*x(8))/x(4) + (7.271*x(5))/x(1) + (8.52*x(6))/x(2) + (6.12*x(7))/x(3) + 43.76/x(4) - 0.7131*x(4)^2 - 0.2537*x(8)^2 + 79.98/x(1) - 0.5984*x(1)^2 - 0.2071*x(5)^2 + 144.8/x(2) - 0.6684*x(2)^2 - 0.2301*x(6)^2 + 61.2/x(3) - 0.632*x(3)^2 - 0.2616*x(7)^2 - 209.059);
复制代码
zhankai.m

  1. function y=zhankai
  2. syms x7 x8 x9 x10 x77 x88 x99 x11
  3. y1=(x7-11-x77)*(-0.8611*x7^2+35.2201*x7+8.2203)/x7-(x7-11-x77)*(-0.2396*x7^2+22.7827*x7+15.4914)/x7-(-0.0231*(x7-x77)^2+2.1299*(x7-x77)+7.8747-(-0.0231*11^2+2.1299*11+7.8747));
  4. y2=-0.2302*x77^2+5.0769*x77+3.3259;
  5. y3=(x8-17-x88)*(-0.9499*x8^2+38.0877*x8+8.0776)/x8-(x8-17-x88)*(-0.2567*x8^2+24.4100*x8+16.5980)/x8-(-0.0248*(x8-x88)^2+2.2839*(x8-x88)+8.4219-(-0.0248+17^2+2.2839*17+8.4219));
  6. y4=-0.2549*x88^2+5.4943*x88+3.4316;
  7. y5=(x9-10-x99)*(-0.9355*x9^2+38.920*x9+11.3939)/x9-(x9-10-x99)*(-0.2773*x9^2+25.7934*x9+17.5138)/x9-(-0.0262*(x9-x99)^2+2.4125*(x9-x99)+8.9007-(-0.0262*10^2+2.4125*10+8.9007));
  8. y6=-0.2878*x99^2+5.9454*x99+3.4438;
  9. y7=(x10-5-x11)*(-1.0184*x10^2+41.1537*x10+8.7158)/x10-(x10-5-x11)*(-0.2784*x10^2+26.4602*x10+17.4686)/x10-(-0.0269*(x10-x11)^2+2.4774*(x10-x11)+9.0828-(-0.0269*5^2+2.4774*5+9.0828));
  10. y8=-0.2806*x11^2+5.9462*x11+3.7885;
  11. k1=expand(y1);
  12. k2=expand(y2);
  13. k3=expand(y3);
  14. k4=expand(y4);
  15. k5=expand(y5);
  16. k6=expand(y6);
  17. k7=expand(y7);
  18. k8=expand(y8);
  19. s1=vpa(k1,4);
  20. s2=vpa(k2,4);
  21. s3=vpa(k3,4);
  22. s4=vpa(k4,4);
  23. s5=vpa(k5,4);
  24. s6=vpa(k6,4);
  25. s7=vpa(k7,4);
  26. s8=vpa(k8,4);
  27. s=s1+s2+s3+s4+s5+s6+s7+s8;
  28. y=s;
  29. end
复制代码
回复 不支持

使用道具 举报

 楼主| 发表于 2010-5-4 23:14:20 | 显示全部楼层 来自 辽宁沈阳
今天偶然找到了答案,必须为function y=opf(x)才可以,否则将出现Too many output arguments谢谢大家啦!

评分

1

查看全部评分

回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-10-7 01:32 , Processed in 0.037116 second(s), 17 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表