multiple simultaneuous equations solver gives error
Mostrar comentarios más antiguos
%Initial seed values for solve block
C_L = 0.7;
C_L_w = 0.5;
C_D = 0.02;
C_tau = 0.4;
alpha_e = 0.1;
C_LT = 0.1;
i = [0 1 2 3 4 5 6 7 8 9 10];
V_knots = 100 + 15*i; %True airspeed range (knots)
V_i = V_knots*0.515; %true airspeed (m/s)
syms C_L C_D C_tau alpha_e C_LT C_LW
% eqn1 = C_L*sin(alpha_e) - C_D*cos(alpha_e) + C_tau*cos(kappa) - 2*m*g/(rho*V_i^2*S)*sin(alpha_e+gamma_e) == 0;
% eqn2 = C_L*cos(alpha_e) + C_D*sin(alpha_e) + C_tau*sin(kappa) - 2*m*g/(rho*V_i^2*S)*cos(alpha_e+gamma_e) == 0;
% eqn3 = C_tau*z_tau/c_w - V_T*C_LT + (C_m0 + (h-h_0)*C_L_w) == 0;
% eqn4 = C_L - C_LT*S_T/S - C_L_w == 0;
% eqn5 = K*C_L^2 - C_D + C_D0 == 0;
% eqn6 = a*(alpha_e + alpha_wr - alpha_w0) - C_L_w == 0;
for i = V_i
eqns = [C_L*sin(alpha_e) - C_D*cos(alpha_e) + C_tau*cos(kappa) == 2*m*g/(rho*V_i(i)^2*S)*sin(alpha_e+gamma_e),
C_L*cos(alpha_e) + C_D*sin(alpha_e) + C_tau*sin(kappa) == 2*m*g/(rho*V_i(i)^2*S)*cos(alpha_e+gamma_e),
C_tau*z_tau/c_w - V_T*C_LT + (C_m0 + (h-h_0)*C_L_w) == 0,
C_L - C_LT*S_T/S - C_L_w == 0,
K*C_L^2 - C_D + C_D0 == 0,
a*(alpha_e + alpha_wr - alpha_w0) - C_L_w == 0];
S(i) = vpasolve(eqns, [C_L(i), C_D(i), C_tau(i), alpha_e(i), C_LT(i), C_LW(i)])
end
gives the error:
Array indices must be positive integers or logical values.
Error in aeroTrim (line 153)
eqns = [C_L*sin(alpha_e) - C_D*cos(alpha_e) + C_tau*cos(kappa) == 2*m*g/(rho*V_i(i)^2*S)*sin(alpha_e+gamma_e),
Please advise on how i can fix this and find the values for the variables. Thank you
1 comentario
You use
for i = V_i
and V_i is complex-valued.
So you can't index arrays with i.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Assumptions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!