Optimization of complex variables in matlab

조회 수: 1 (최근 30일)
Gina
Gina 2014년 1월 8일
댓글: Matt J 2014년 1월 8일

I am working with some optimization, I need to find the best $Lxp$ which is a control gain by minimizing the objective function $obj$ wich is the magnitude of the squares of the eigenvalues of phi_sol minus the values I enter $p1$ and $p2$. By programming in Matlab I have done this function.

function obj=objetivo(Lxp)%x,phi,gamma0,gamma1)
  global phi; %phi=[1 1;0 1]
  global gamma0; %  gamma0=[0.4900; 0.9900]
  global gamma1; %  gamma1=[0.0100; 0.0100]
  global p1
  global p2
  phi_sol= [1 0;0 1];
  for k=1:100
  phi_sol=phi+gamma0*Lxp+ gamma1*Lxp*inv(phi_sol);
  end
  E=vpa(eig(phi_sol))
  obj=abs((E(1)-p1)^2+(E(2)-p2)^2)

The optimization is done by using fminsearch so I do:

>>options = optimset('MaxFunEvals',10000,'TolFun',10^-11,'MaxIter',100000);
>>global p1; global p2; p1=0.7;p2=0.6;
>>[XOUT,FVAL,EXITFLAG]=fminsearch(@objetivo,[0.8 0.9],options)

It converges being $XOUT=[-0.1182 -0.6334]$ which is Lxp.

The problem comes when I need to find solution Lxp for complex $p1$ and $p2$, for example $p1=0.7+0.1*i$;$p2=0.6+0.05i$. My questions are: How should I work with complex variables in this particular optimization problem? How do I split them $p1$, $p2$ and E indeed, and calculate the objective function by using real and complex part?

  댓글 수: 1
Matt J
Matt J 2014년 1월 8일
obj=abs((E(1)-p1)^2+(E(2)-p2)^2)
this looks like it should really be
obj=norm(sort(E)-sort([p1;p2])).^2

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2014년 1월 8일
See here for the relevant technique
Also, I recommend you stop using global variables to pass fixed parameters to functions. There are better ways using anonymous and nested functions, discussed here

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by