cvx_begin quiet

variable p(K,1)

expression weight(L,K,M);

expression f_n(K,M)

expression f_n_part1(K,M)

for s = 1:M

for k = 1:K

for i = 1:K

for m = 1:M

if i==k&&m==s

term2(:,:,k,i,s,m) = 0;

else

term2(:,:,k,i,s,m) = dki(:,k,i,s,m)*dki(:,k,i,s,m)';

end

end

weight(:,k,s) = pinv(squeeze(sum(p(i,1)*sum(term2(:,:,k,:,s,:),6),4))+sigma2*A(:,:,k))*b(:,k);

end

end

end

command-line window：

Incorrect use of svd

The first input must be a single or double precision value.

Error pinv (line 18)

[U,S,V] = svd(A,‘econ’);

Q:How do I invert a matrix with a cvx variable if I can’t use the pinv function?