I have an error I got from using fsolve but I do not understand why.
Afficher commentaires plus anciens
clear all;
clc;
W = 1248.5*9.81;
S = 17.1;
K = 0.05;
CDe = 0.03;
h = 0;
[T, p, rho, speedsound] = atmos(h);
V = 100 % random speed for test
Tava = (4 * ( (7 + V/speedsound )*200/3 + h*(2*V/speedsound) - 11) )
% x(1) = CL
func_1 = @(x) ((x(1))^2)/K + Tava/W*x(1) -3*CDe ; % Condition for max RC
FUNC = @(x) [func_1(x)];
CL = fsolve(@(x) FUNC(x), [0])
CD = 0.03 + 0.05*CL^2
% x(2) = alpha
% x(3) = eledefl
func_2 = @(x) 6.44*x(2) + 0.355*x(3) - CL ; % CL
func_3 = @(x) 0.03 + 0.05*(6.44*x(2) + 0.355*x(3))^2 - CD ; % CD
FUNC = @(x) [func_2(x); func_3(x)];
X = fsolve(@(x) FUNC(x), [0 0])
%
% aoa = X(1)
% eledefl = X(2)
I can solve for x(1) but not x(2) and x(3).
I got this error "Index exceeds the number of array elements (2).", however I dont understand what it means.
How can I solve this?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!