声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 983|回复: 1

[编程技巧] 非线性规划的问题,请各位帮忙啊

[复制链接]
发表于 2006-5-2 00:07 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
<P>51学校数模竞赛,可是对matlab实在是不熟悉啊。现有一个编译错误始终想不明白啊。<BR>请看:<BR>function f=fun4(x);   <BR> f= -x(1)*x(2) - 10*x(3);  <BR>这个是目标方程文件名为fun4.m </P>
<P>function [g,ceq]=mycon(x)</P>
<P>      g=[x(2) * 2.22/sin(x(4)) + 4.82*cos(x(4)) + 2.22*cos(x(4))/tan(x(4)) - 193.7;<BR>          x(3) * 2.29/sin(x(4)) + 4.93*cos(x(4)) + 2.29*cos(x(4))/tan(x(4)) - 193.7;<BR>        (4.82 * sin(x(4)) + 2.22*cos(x(4)) ) * x(1) + x(1) * 0.5 *(5.7-2.5*cos(x(4))) +...  <BR>        (4.93*sin(x(4)) + 2.29*cos(x(4))) * 10 + 5*(6.3 - 2.6*cos(x(4)))  - 300];<BR>这个是非线性的约束条件,文件名为mycon.m    <BR><BR>x0=[20;30;30;pi/4];<BR>A=[];b=[];<BR>Aeq=[];beq=[];<BR>vlb=[0 0 0 0];vub=[70 100 90 pi/2];<BR>[x,fval]=fmincon('fun4',x0,A,b,Aeq,beq,vlb,vub,'mycon')<BR>这个是主程序。<BR>??? Error using ==&gt; fmincon<BR>FMINCON cannot continue because user supplied nonlinear constraint function<BR> failed with the following error:</P>
<P>One or more output arguments not assigned during call to 'feval'.<BR>可是每次运行都出现这么一句话??这句话是什么意思啊?是不是约束条件不够呢?</P>
回复
分享到:

使用道具 举报

 楼主| 发表于 2006-5-2 11:45 | 显示全部楼层

解决了

我自己解决了。原来是语法有错误,应该在mycon中加入ceq= [];
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-25 21:22 , Processed in 0.055875 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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