How to deal with this problem,{invalid} .* {real affine}

I am a new user of cvx and have encountered some problems. I hope someone can help me. Thank you very much.

The code is as follows:

%%

M=3; N=3;
NT=6; alfa=2.2;
x_bs=0;y_bs=0;
P_sum=0;Num=0;
degree=random(‘unif’,0,2*pi,1,M);
r =random(‘unif’, 0,10,1,M);

x_ID=r.*cos(degree); y_ID=r.*sin(degree);

degree=random(‘unif’,0,2*pi,1,N);

r =random(‘unif’,0,10,1,N);

x_EH =r.*cos(degree); y_EH=r.*sin(degree);

d_ID=sqrt(y_ID.^2+x_ID.^2); d_EH=sqrt(y_EH.^2+x_EH.^2);

hm=(randn(NT,M)+1i*randn(NT,M))/sqrt(NT)/sqrt(2);

hn=(randn(NT,N)+1i*randn(NT,N))/sqrt(NT)/sqrt(2);

a=hm*(hm’*hm)^-1;

b=hn*(hn’*hn)^-1;
for m=1:M
tm(:,m)=hm(:,m)*sqrt(d_ID(m)^(-alfa));
am(:,m)=a(:,m)*sqrt(d_ID(m)^(-alfa));
A(:,:,m)= am(:,m)*am(:,m)’;
end
for n=1:N
gn(:,n)=hn(:,n)*sqrt(d_EH(n)^(-alfa));
bn(:,n)=b(:,n)*sqrt(d_EH(n)^(-alfa));
B(:,:,n)=bn(:,n)*bn(:,n)’;
end

%%


lam=0.5;    lan=0.5;
snr_md=10^(1/10);snr_mu=10^(1/10); snr_nu=10^(1/10);
sgm=10^-6;
u1=ones(10,3,M);
u2=ones(10,5);u3=ones(10,2,N);
l=1;k=1; 
u2(k,1)=0.23;u2(k,2)=0.5;
u1(k,1,:)=0.001; u1(k,2,:)=0.001;u1(k,3,:)=0.01;
u3(k,1,:)=0.001;u3(k,2,:)=0.001;

%
%%

   for i=1:10
    cvx_begin sdp               
    variable W(NT,NT,M) hermitian
    variable V(NT,NT,N) hermitian
    variables m_p(m)  pm(m) pn(n) y(m) z(m) t(m) r(n) tao 
    variable taom(m) nonnegative
    variable taon(n) nonnegative
    expressions Im(M) In(N) Inom(M) Pm Pn P Imn(M) Inm(N) Taom Taon 
    
    for m=1:M
        oth_m = find(1:M~=m);
        for nm = 1:M-1
            Inom(m) = Inom(m) + tm(:,m)'*W(:,:,oth_m(nm))*tm(:,m);
        end
        for n=1:N
            Imn(m)=Imn(m)+tm(:,m)'*V(:,:,n)*tm(:,m); 
        end
        for w=1:M
            Im(m) = Im(m) + tm(:,m)'*W(:,:,w)*tm(:,m);
        end
        Pm = Pm + trace(W(:,:,m));
    end        
    
    for n=1:N
        for m=1:M
            Inm(n)=Inm(n)+gn(:,n)'*W(:,:,m)*gn(:,n);
        end
        for v=1:N
            In(n) = In(n) + gn(:,n)'*V(:,:,v)*gn(:,n);
        end
        Pn = Pn + trace(V(:,:,n));

    end
    P = Pm+Pn ;
    
    minimize P 
    subject to
    
    0<=tao<=1; 
    for m=1:M
        real(tm(:,m)'*W(:,:,m)*tm(:,m)) >= snr_md* (real (Inom(m) + Imn(m))+ sgm+sgm*inv_pos(m_p(m)));%9
        lam*  real(Im(m)+Imn(m)) >= quad_over_lin(y(m),z(m));%2
        2*u1(k,1,m)*y(m)*inv_pos(u1(k,2,m))-u1(k,1,m)^2*taom(m)*pow_pos(inv_pos(u1(k,2,m)),2) >= pm(m); %3
        1-m_p(m) >= quad_over_lin(t(m),tao);%4
        2*u1(k,3,m)*t(m)-u1(k,3,m)^2 >= z(m);%5
        pm(m)*real(tm(:,m)'*A(:,:,m)*tm(:,m)) >= snr_mu * sgm* real (trace(A(:,:,m)));   %10 
        Taom=Taom+taom(m);
        W(:,:,m)>=0; V(:,:,n)>=0; y(m)>=0; z(m)>=0;  0<=m_p(m)<=1;  pm(m)>=0;  taom(m)>=0;  t(m)>=0;
    end
      Taom==1-tao;
    for n=1:N
        lan* real(In(n)+Inm(n)) >= quad_over_lin(r(n),tao); %6 
        real(2*u3(k,1,n)*r(n)*(inv_pos(u3(k,2,n)))-u3(k,1,n)^2*taon(n)*pow_pos(inv_pos(u3(k,2,n)),2)) >= pn(n) %7
        pn(n)* real (gn(:,n)'*B(:,:,n)*gn(:,n)) >= snr_nu* sgm * real (trace(B(:,:,n)));%11
        Taon=Taon+taon(n);
        W(:,:,m)>=0;     V(:,:,n)>=0;     pn(n)>=0;  taon(n)>=0; r(n)>=0; 
    end
    Taon==1-tao;
    cvx_end
    %%
    l=k;
    u2(k,3)= P;u2(k,4)=pm(m);u2(k,5)=pn(n);
    k=k+1;
    for m=1:M
        u1(k,1,m)=real(sqrt(pm(m)*taom(m)));
        u1(k,2,m)=real(y(m)^2/pm(m));
        u1(k,3,m)=real(sqrt(z(m))); 
    end
    for n=1:N
        u3(k,1,n)=real(sqrt(pn(n)*taon(n)));
        u3(k,2,n)=real(r(n)^2/pn(n));
    end
    if (i >= 2)
        j=l-1;
    else
        continue;
    end
    if ((abs(u2(j,3)-u2(l,3)) <=0.001 && abs(u2(j,4)-u2(l,4)) <=0.001&&abs(u2(j,5)-u2(l,5))<=0.001) ==0)
        continue;
    else
        
        break
    end
    
end
%%
if strfind(cvx_status,'Solved')
    flg=1;
else
    flg=0; W=0; V=0; P=0;
    return;
end
%%
if flg==1    
    P_sum = P_sum+P;
    Num = Num+1;
    for m=1:M
        svd(W(:,:,m));  
    end
    for n=1:N
        svd(V(:,:,n));
    end
end

Give the result as follows:

Thank you for your reply. Do you mean there is a problem with sca iteration? I found that after running, I can only iterate three times. And the value of each iteration is increasing until the above error results appear. How can I solve it? We look forward to your reply!