I have an iterative program in which there are some initial points that have to be updated in each iteration. in each of the iterations several cvx scalar and vector variables should be derived and some of them should be used in next iteration as initial points. i have used for loop for iterations and the program has a process like below. unfortunately I do not get desired points and in the second iteration the program gives an error. because some variables go in wrong range. I wanted see if my program procedure is ok or not.
> cvx_solver sedumi
> for i=1:Nmax
> cvx_begin
> variables z tb te wb we akstar(K) betta q(K)
> variable v(L-NE) complex
> minimize z
> ((we0(i))/log(2))+((we-we0(i))/(we0(i)*log(2)))-te<=z %constraint 1
> landa(i)=betta0(i)/tb0(i);
> sigma=0;
> for ii=1:K
> if ii~=kstar
> teta(ii,i)=akstar0(ii,i)/tb0(i);
> sigma=sigma+.5*teta(ii,i)*tb^2+.5/teta(ii,i)*akstar(ii)^2;
> end
> end
> sigma+.5*sigma2*landa(i)*tb^2+.5*sigma2/landa(i)*betta^2+sigma2*tb-wb<=z %constraint 2
> for jj=1:K
> if jj~=kstar
> quad_over_lin(A1(:,:,kstar,jj)*v,q(jj))-akstar(jj)<=z %constraint 3
> end
> end
> Qphi=sqrtm(phi(:,:,kstar));
> for k=1:K
> Qphi_k(:,:,k)=sqrtm(phi(:,:,k));
> end
> norm(Qphi*v)-betta<=z %constraint 4
> inv_pos(q)<=Psk %39k
> expression sum_F_el(L)
> for l=1:L
> sum_F_el(l)=0;
> for k=1:K
> sum_F_el(l)=sum_F_el(l)+quad_over_lin(A3(:,:,k,l)*v,q(k));
> end
> sum_F_el(l)+sigma2*norm(Esqrt(:,:,l)*v)<=Ql;% constraint 11
> end
> %determining initiAL POINTS FOR NEXT ItERATION shown by index 0(i+1)
> tb0(i+1)=tb;
> we0(i+1)=we;
akstar0(:,i+1)=akstar; betta0(i+1)=betta; q0(:,i+1)=q;
end