# Cannot perform the operation: {convex} .* {positive constant}

I looped 20 times cvx to solve the optimization vector w, of which FI is weighted by w. After the first solution, it was NAN, and then the error was reported.
c=0; FI=ones(n,1);
%optimization
for l=1:20
cvx_begin
variable w(n,1) complex
for ll = 1:n
c=abs(w(ll))*FI(ll)+c; % 累加每次循环中的计算结果
end
minimize(c)
subject to
for i=1:length(ind)
real(As(:,i).'*w)<=10^(-30/20);
end

`````` for ii=1:length(inm)
real(Am(:,ii).'*w)>=10^(-0.4/20);
real(Am(:,ii).'*w)<=0
end
``````

cvx_end
w0=w;
FI=inv_pos(abs(w0)+10^(-5));
end;

w is weighted by FI,

This is a two-dimensional model but in my code it is a one-dimensional model

I’m not clear on exactly what error message you received when. Perhaps Error message with {invalid} is due to NaN, Inf, or -Inf in input data is relevant.

Dear Mr. Mark, may I ask if my code is convex?FI=ones(n,1);

``````cvx_begin
variable w(n,1) complex
minimize( abs(w.')*FI)
subject to
for i=1:length(ind)
real(As(:,i).'*w)<=10^(-30/20);
end
for ii=1:length(inm)
real(Am(:,ii).'*w)>=10^(-0.4/20);
real(Am(:,ii).'*w)<=0;
end
``````

it looks convex. The `.` after `w` in the objective function, is extraneous, but does no harm, although it is suggestive of inattentive coding.

Whether your overall iterative scheme converges to anything, let alone a global or even local minimum of the original problem, is another matter.

Note that you should be telling us, not asking us, whether a problem is convex, as discussed at Why isn't CVX accepting my model? READ THIS FIRST!