Hi,

This is my first time to use vector fitting and optimization techniques for system modeling. Currently, I succeeded to fit the frequency response of Y matrix, but the resulted residues do not follow the principle of passivity. I am trying to use CVX to enforce the passivity. The model used for optimization (thanks to Zohaib Mahmood)is as:

minimize |sum(Re(Y(i))-Re(Ym))|+|sum(Im(Y(i))-Im(Ym))|

(sorry for the ugly expression here, I do not know how to use MathJax)

where Y(i)=Rr(1)/(s-ar(1))+…+Rr(kr)/(s-ar(kr))+Rc(1)/(s-ac(1))+…+Rc(kc)/(s-ac(kc))+D+s*E .

Ym are 251 measured data, ar and ac are real poles and complex poles respectively. My goal is to find constrained Rr,Rc and D, so as to minimize the difference between Y(i) and Ym at each frequency point.

The optimized result does not match the original response very well. I hope someone here can help me to solve the problem. I doubt that there may be some problems when I edit the cvx code, especially the objective function.

The Matlab code is written as:

```
cvx_clear
cvx_begin sdp
variable Rr(1,length(ar)); //real residue
variable Rc(1,kc/2) complex; //complex resiude
variable S(length(s));
variable D ;
variable E;
expression ex(3);
expression yx(length(s));
for m=1:length(s)
ex(1)=0;
ex(2)=0;
ex(3)=0;
sk=s(m);
for k=1:kr
ex(1)=ex(1)+Rr(k)/(s(m)-ar(k));
end
for k=1:kc/2
ex(2)=ex(2)+Rc(k)/(sk-(ac(2*k-1)))+conj(Rc(k))/(sk-ac(2*k));
end
ex(3)=ex(1)+ex(2)+D+sk*E;
yx(m)=abs(real(ex(3))/real((f(1,m))))+abs(imag(ex(3))-imag((f(1,m))));
//f is the measured data as Ym
end
yx<=S;
minimize (norm(S,2));
subject to
D>=0;
Rr>=zeros(1,kr);
for k=1:kc/2
-real(ac(2*k))*real(Rc(1,k))+imag(ac(2*k))*imag(Rc(1,k))>=0;
-real(ac(2*k))*real(Rc(1,k))-imag(ac(2*k))*imag(Rc(1,k))>=0;
end
cvx_end
```