# An error in the use of dynamic variable

Hi Guys!

In recently, I find this situation when i run the simulations. And I can’t seem to figure out how to do so for the error. The code is following:

``````cvx_begin quiet
variable W(N,N,M) hermitian;
variable xm(M);
variable ym(M);
expression Sum_trace;
for m = 1:M
Um(:,m) = sqrt(Cm)*((1/gamma_m+1)*W(:,:,m) - sum(W,3))*H(:,m);
cm(m) =  Delta^2 - H(:,m)'*((1/gamma_m+1)*W(:,:,m) - sum(W,3))*H(:,m);
Qm(:,:,m) = sqrt(Cm)*((1/gamma_m+1)* W(:,:,m) - sum(W,3))* sqrt(Cm);    % here is an error!
end
for m=1:M
Sum_trace =Sum_trace+trace(W(:,:,m));
end
minimize (Sum_trace)
subject to
for m=1:M
trace(Qm(:,:,m)) - sqrt(2*Dm)*xm(m) - Dm*ym(m) >= real(cm(m));
norm([reshape(Qm(:,:,m),[],1);sqrt(2)*Um(:,m)]) <= xm(m);
ym(m)*eye(N,N)+Qm(:,:,m) == hermitian_semidefinite(N);
ym(m)>=0;
W(:,:,m) == hermitian_semidefinite(N);
end
cvx_end
``````

Result on matlab give:

``````Error using  <
Matrix dimensions must agree.

Error in cvx/subsasgn (line 49)
if any( szx_n < szx ),

Error in My_id (line 47)
Qm(:,:,m) = sqrt(Cm)*((1/gamma_m+1)* W(:,:,m) - sum(W,3))* sqrt(Cm);
``````

But the dimension of the matrix that the right side of the equation does not change! I have a limited to no experience with CVX. Can anyone give me a favor?

Looks like a bug. I would suggest submitting a report to http://support.cvxr.com with full information about how to reproduce the error and the output of `cvx_version`.

We’ve identified the bug causing this problem and will be including a fix in an upcoming release of CVX.