please tell me right command(fmincon) to get output for this problem

1 visualizzazione (ultimi 30 giorni)
THIS IS THE MAIN FUNCTION
function [f] = myfun(x)
wcg=2.1; %gain cross over frequency
bb=4;
cc=60;
r = x(1) + (x(2)*(wcg^(-x(4)))*cos(90*x(4)*(pi/180)))+ (x(3)*(wcg^(x(5)))*cos(90*x(5)*(pi/180)));
s = - x(2)*wcg^(-x(4))*sin(90*x(4)*pi/180)+ x(3)*wcg^(x(5))*sin(90*x(5)*pi/180);
fun1=bb/sqrt((cc*wcg)^2 +1);
fun2=sqrt((r)^2 + (s)^2);
f = 10*log10(fun1*fun2);
end
ANOTHER PROGRAM FOR CONSTRAINTS
function [c, ceq] = confun(x)
wcg=2.1;
wt=10;
ws=0.01;
aa=2;
bb=4;
cc=60;
dd=80;
ff=0;
fipm=80; %phase margin
r = x(1) + ( x(2)*(wcg^(-x(4)))*cos(90*x(4)*(pi/180)) )+(x(3)*(wcg^(x(5)))*cos(90*x(5)*(pi/180)));
% pi/180 give degree value in radians
s = - x(2)*(wcg^(-x(4)))*sin(90*x(4)*(pi/180))+ x(3)*(wcg^(x(5)))*sin(90*x(5)*(pi/180));
ru = -x(2)*x(4)*(wcg^(-x(4)-1))*cos(90*x(4)*(pi/180))+ x(3)*x(5)*(wcg^(x(5)-1))*cos(90*x(5)*(pi/180));
su = -x(2)*x(4)*(wcg^(-x(4)-1))*sin(90*x(4)*(pi/180))+ x(3)*x(5)*(wcg^(x(5)-1))*sin(90*x(5)*(pi/180));
rt = x(1) + x(2)*(wt^((-x(4))))*cos(90*x(4)*(pi/180))+ x(3)*(wt^x(5))*cos(90*x(5)*(pi/180));
st = -x(2)*(wt^(-x(4)))*sin(90*x(4)*(pi/180))+x(3)*(wt^x(5))*sin(90*x(5)*(pi/180));
rs = x(1) + x(2)*(ws^(-x(4)))*cos(90*x(4)*(pi/180))+ x(3)*(ws^x(5))*cos(90*x(5)*(pi/180));
ss = -x(2)*(ws^(-x(4)))*sin(90*x(4)*(pi/180))+ x(3)*(ws^x(5))*sin(90*x(5)*(pi/180));
%1 equation(41)
c1 = (atan(s/r)*180/pi)-(atan(dd*wcg)*180/pi)-(wcg*ff)+180-fipm;
% 180/pi give radian value in degrees
%2 equation(42)
c21 = 1/(1+(s/r)^2);
c22 = (su*r-s*ru)/(r)^2;
c23 = dd/(1+(dd*wcg)^2);
ceq = [c1;c21*c22-c23-ff];
%3 equation(43)
c31 = aa*sqrt((rt^2) + (st^2));
c32 = sqrt((1+aa*rt)^2 + (dd*wt+aa*st)^2);
c3 = (10*log10(c31/c32))+20;
%4 equation(44)
c41 = sqrt((cc*ws)^2 +1);
c42 = sqrt((1+bb*rs)^2+(cc*ws+bb*ss)^2);
c4 = (10*log10(c41/c42))+20;
c=[c3;c4];
end
PLEASE TELL ME THE RIGHT COMMAND TO BE WRITTEN IN COMMAND WINDOW,THE COMMAND I HAVE GIVEN IS UNABLE TO FIND THE RIGHT SOLUTION
>> x0=[6.7441;27.7461;0.0063;0.1461;0.7874];
>> options=optimset('Algorithm','active-set');
>> [x,fval,exitflag,output,lambda,grad,hessian]=fmincon(@myfun,x0,[],[],[],[],[],[],@confun,options)
BY GOING THROUGH DIFFERENT EXAMPLES IN MATLAB HELP ,I GAVE THESE COMMAND BUT I AM UNABLE TO GETHT SOLUTION ............PLEASE HELP.
  9 Commenti
Sargondjani
Sargondjani il 13 Mag 2012
you mean the objective function has a better value at your initial guess than the final result???
the only logical explanation seems to be that the initial guess does not satisfy the constraints... You should check this. If it doesnt, than there is probably a typo in your constraints (easily possible witht his long code)
If you are certain this is not the case (which would surprise me), than maybe you can show the exit message, and the function/objective value at the initial guess? That would probably be helpfull in finding the problem....
kintali narendra
kintali narendra il 17 Mag 2012
[x,fval]=fmincon(@newfrac,x0,[],[],[],[],[0;0;0;0;0],[inf;inf;inf;0.9;0.9],@confun,options)
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x =
0.0000
0.7587
0.1891
0.7928
0.9000
fval =
-22.0702
sir i need to reduce the value of function zero,please tell some more changes.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by