Error "Not enough input arguments" error in Line 5
Show older comments
Im fairly new to Matlab and im trying to write a program that solve the 3 Degrees of Freedom Equations of Motion for an aircraft using ode23. I have the following equations
X=Ucos(Theta) (Calculates Horizontal Distance)
h=Usin(Theta) (Calculates Height)
U=(-D-mgsin(theta))/m (Calculates Speed)
theta=(-L-mgcos(theta))/(mU) (Calculates angle)
I have the following code.
Hi= 10; %Initial Height
Ui= 7.5; %Initial Speed
THi= -4; %Initial Theta
D= 10; % Drag
L= 15; % Lift
m= 40; %mass
g= 9.81; %Gravity
TSpan = [0 100]; %Time Range
[time,y] = ode23('EoM',TSpan,[0 Hi Ui THi]);
plot(time, y);
The EoM Function is
function v = EoM(D,L,m,g)
v= zeros(4,1);
v(1)=v(3)*cos(v(4)); % Distance Equation
v(2)=v(3)*sin(v(4)); % Height Equation
v(3)=(-D-(m*g*sin(v(4))))/(m); % Speed Equation
v(4)=(-L-(m*g*cos(v(4))))/(m*(v(3))); % Angle Equation
end
Im getting the following error
Not enough input arguments.
Error in EoM (line 5)
v(3)=(-D-(m*g*sin(v(4))))/(m);
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode23 (line 114)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in AeroEqOfMotion (line 9)
[time,y] = ode23('EoM',TSpan,[0 Hi Ui THi]);
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!