用MATLAB fmincon函数求解一个有约束非线性问题,麻烦给个程序和结果,谢谢
minF(X)=4*(x1-5)^2+(x2-6)^2s.tg1(X)=x1^2+x2^2-64>=0g2(X)=x2-x1-10<=0g3(X)=x1-10<=0用fm...
minF(X)=4*(x1-5)^2+(x2-6)^2
s.t
g1(X)=x1^2+x2^2-64>=0
g2(X)=x2-x1-10<=0
g3(X)=x1-10<=0
用fmincon函数编程,不是function函数,再用工具箱求解,给个截图,麻烦高手了,要交报告,急啊。。。。。。。。。。 展开
s.t
g1(X)=x1^2+x2^2-64>=0
g2(X)=x2-x1-10<=0
g3(X)=x1-10<=0
用fmincon函数编程,不是function函数,再用工具箱求解,给个截图,麻烦高手了,要交报告,急啊。。。。。。。。。。 展开
1个回答
展开全部
求解代码如下:
function zd1381661017193379500
fmincon(@(x)4*(x(1)-5)^2+(x(2)-6)^2,[5 6],[],[],[],[],[],[],@noncon)
function [c,ceq] = noncon(x)
c(1)=-(x(1)^2+x(2)^2-64);
c(2)=x(2)-x(1)-10;
c(3)=x(1)-10;
ceq = [];
保存成M文件运行即可。
运行输出如下:
>> zd1381661017193379500
Warning: The default trust-region-reflective algorithm does not solve problems with the constraints you
have specified. FMINCON will use the active-set algorithm instead. For information on applicable
algorithms, see Choosing the Algorithm in the documentation.
> In fmincon at 504
In zd1381661017193379500 at 2
Warning: Your current settings will run a different algorithm (interior-point) in a future release.
> In fmincon at 509
In zd1381661017193379500 at 2
Local minimum possible. Constraints satisfied.
fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance and constraints are
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-06):
lower upper ineqlin ineqnonlin
1
ans =
5.0427 6.2105
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询