# How to solve nonlinear sdp iteratively

I am trying to solve a nonlinear sdp iteratively in a for loop. The constant matrices are updated after each iteration and are used in the next iteration. The question is how to initialize the variables using the solution from the previous iteration? Also, is it possible to set initial value for the variables? This is the MIMO PID optimization problem in Prof. Boyd’s paper and the matrices have complex values. I think I did it incorrectly as the solver stopped with status: Infeasible after the first iteration. Here is my code. Any help or guidance is greatly appreciated!

``````ni = 2;
no = 2;
ns = 295;
KPP = zeros(ni,no);
KIP=0.01*pinv(plant_K);
KDP = zeros(ni,no);

%% solve SDP problem
itn = 1;
oim = inf;
pso = inf;
while itn < 30 && oim > 1e-3
cvx_begin sdp
variables tsq;
variables KP(ni, no) KI(ni, no) KD(ni, no);
expression ipc2(no,no,ns);
% if itn==1
%   KP=KPP;
%   KI=KIP;
%   KD=KDP;
% end

for i=1:1:ns
ipc2(:,:,i) = zkc(:,:,i)'*(ones(no)+pkc(:,:,i)*(KP+KI/wkc(i)+KD/(tau_sf+1/wkc(i))))+(ones(no)+pkc(:,:,i)*(KP+KI/wkc(i)+KD/(tau_sf+1/wkc(i))))'*zkc(:,:,i)-zkc(:,:,i)'*zkc(:,:,i);
end
maximize(tsq);
subject to
vk'*(plant_K*KI)+(plant_K*KI)'*vk-vk'*vk >= tsq*ones(no);
for i=1:1:ns
ipc2(:,:,i) >= prhs(1,1)*ones(no);
[ipc2(:,:,i),(pkc(:,:,i)*(KP+KI/wkc(i)+KD/(tau_sf+1/wkc(i))))'/pmax(2);pkc(:,:,i)*(KP+KI/wkc(i)+KD/(tau_sf+1/wkc(i))),ones(no)] >= 0;
[ipc2(:,:,i),((KP+KI/wkc(i)+KD/(tau_sf+1/wkc(i))))'/pmax(3);(KP+KI/wkc(i)+KD/(tau_sf+1/wkc(i))),ones(no)] >= 0;
end
cvx_end
KP=KP(:,:)
KI=KI(:,:)
KD=KD(:,:)
pidc(:,:,1)=KP;
pidc(:,:,2)=KI;
pidc(:,:,3)=KD;
[xkc,zkc,vk] = cltfp(pkc,wkc,pidc,tau_sf,plant_K);
itn=itn+1;
oim=abs(pso-cvx_optval)/abs(cvx_optval);
pso=cvx_optval;
end``````

Try using YALMIP’s nonlinear SDP capabilities (PENLAB or BMIBNB).