 # Value of type 'cvx' is not convertible to 'double'

Hello！I wonder how to solve this problem：When I use “expression c2”,“expression c1”,I got the wrong number and the program does not report an error; But when I used “c1=0.000926;c2 = 2250;”,I got the right number and the program report an error, and display “Unable to perform assignment because value of type ‘cvx’ is not convertible to ‘double’.” in E(l,1)=c1pow_pos(norm(v_opt(l)),3)+c2inv_pos(v_opt(l));.

while 1
cvx_begin quiet
variable v_opt(length(t));
expression tempRate(48,1)
% expression c2
% expression c1

``````     % f
for k=1:K
for n=1:N
pkn=sum(pSolution(n,1));  % Pk,n
end
tempRate(k,1)=log(alpha*(H^2+re(k))+pkn)/log(2);
end
f=sum(tempRate(:));

% g
for l=1:2
E(l,1)=c1*pow_pos(norm(v_opt(l)),3)+c2*inv_pos(v_opt(l));
end
g=sum(E(:));
M=f-elta(c)*g;

maximize M
subject to
``````

cvx_end

re-open your matlab. and use" c1=0.000926;c2 = 2250;” instead of the other.

I tried. It’s still wrong.

You need to declare `E` as an expression (holder) of the correct dimensions. http://cvxr.com/cvx/doc/basics.html#assignment-and-expression-holders .

I don’t know if that is your only error, but you need to at least fix that.

Also, don’t use quiet` until you have verified everything is working correctly.