# CVX zero expression

I asked a question about the following code a few weeks ago:

``````for i = 1:29
dis1 = [dis1,norm([p1(1,i+1),p1(2,i+1)]-[p1(1,i),p1(2,i)])*1000];
V1(i) = (700/3.6) + ((920/3.6)-(700/3.6))*rand(1);
CL1 = [CL1,((W1(i).*g)/(0.5*density*(V1(i).^2)*S))];
CD1 = [CD1,(CDo + ((CL1(i).^2)/(3.14*AR*e)))];
Thrust1(i) = ((CD1(i)/inv_pos(CL1(i)))*(W1(i)*g))/1000;
Wf1 = [Wf1,SFC*Thrust1(i)*(dis1(i)/V1(i))];
W1(i+1) = W1(i)-Wf1(i);
end
``````

I was getting errors with the notation I was using. You gave me some good tips and they worked out great. Your advice was to declare Wf1 and W1 as expressions. The model now runs very smoothly, the only issue now is that I keep getting zero matrices for CL, CD, Thrust, Wf1 and W1. I get ‘cvx zero expression’ and the final matrix is a matrix full of zeros.

Is there a way around this? Is there a way to specify that the ‘expressions’ be non-zero?

Perhaps your model is not appropriate to your needs? As an easy, but not necessarily good, fix, you could impose some constraints, such as (1,2,inf, or whatever) norm of constraint being >= some specified value, or some other constraint(s) to achieve what you want. Or maybe modify the objective.

And if such modifications seem ad hoc, perhaps it’s an indication that your model is not well-suited for your needs. In comment above, that should be norm of expression, not norm of constraint.