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?