请教fmincon,No feasible solution found。

程序代码:global l xc;%全局变量
l=0.3;
xc =[3.4200;1.7100];
g1=@(x)(((x(1)-xc(1))/l)^2*(x(2)-xc(2))/l/20-1)
x0=xc;
XW=[0.9;0.9];
xl=xc-XW
xr=xc+XW
opts=optimset('Algorithm','active-set');
[x1,gx1]=fmincon(g1,x0,[],[],[],[],[xl(1);xl(2)],[xr(1);xr(2)],@Reliability_Assessment,opts);
function [cx,ceqx]=Reliability_Assessment(x)
%xc=[3.1623;4.7434;3.1623];
global l xc;%全局变量
cx=[];
% ceqx=[-gst1];
ceqx(1)=((x(1)-xc(1))/l)^2+((x(2)-xc(2))/l)^2-9;
出现的问题:不能求解,请问该如何修改,谢谢。具体提示如下
No feasible solution found.
fmincon stopped because the predicted change in the objective function
is less than the default value of the function tolerance but constraints
were not satisfied to within the default value of the constraint tolerance.
<stopping criteria details>

 Accepted Answer

bobox
bobox on 23 Nov 2022
初值不合理所致。你这里 x 必须满足在一个圆心为 xc,半径为 3l 的圆上取点,而你的初值并非是在这个圆上。其实,你这个问题可以简化为一元变量的最小值求解,你的 x 可以写成:
x(1) = xc(1) + 3*l*cos(theta)
x(2) = xc(2) + 3*l*sin(theta)
这样,变成一个只有 theta 的一元变量的最小值求解,且不在含有非线性约束 Reliability_Assessment,这样求解起来会简单很多

More Answers (0)

Categories

Find more on Aerospace Blockset in Help Center and File Exchange

Tags

Asked:

on 23 Nov 2022

Answered:

on 23 Nov 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!