ODE45 Code Issue
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Any help would be greatly appreciated on this code! The error messages are located beneath the code.
[T,X] = ode45(@(t,x) ode45for3B(t,x), [0,10], [0,0]);
function [xdot] = ode45for3B(t,x)
xdot = [0;0;0;0];
xdot(1) = x(2);
xdot(2) = (-5.667).*x(1) - (1.333333).*x(2) + (3.667).*x(3) + (1.333333).*x(4);
xdot(3) = x(4);
xdot(4) = (2.5).*x(1) + (0.9091).*x(2) - (2.5).*x(3) - (0.9091).*x(4) + (4.5454);
end
Index exceeds the number of array elements (2).
Error in ME357_HW6_3B>ode45for3B (line 15)
xdot(2) = (-5.667).*x(1) - (1.333333).*x(2) + (3.667).*x(3) + (1.333333).*x(4);
Error in ME357_HW6_3B>@(t,x)ode45for3B(t,x) (line 10)
[T,X] = ode45(@(t,x) ode45for3B(t,x), [0,10], [0,0]);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in ME357_HW6_3B (line 10)
[T,X] = ode45(@(t,x) ode45for3B(t,x), [0,10], [0,0]);
0 Kommentare
Antworten (1)
Star Strider
am 5 Mär. 2020
Four differential equations require four initial conditions.
[T,X] = ode45(@(t,x) ode45for3B(t,x), [0,10], [0,0]);
↑ ← HERE
there are only two.
2 Kommentare
Star Strider
am 5 Mär. 2020
My pleasure!
If my Answer helped you solve your problem, please Accept it!
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!