Numerical Differential Equation Matrix Form with Forcing Function
Ältere Kommentare anzeigen
I'm trying to solve a fourth order differential equation with a forcing function t*e^(2t) with ODE45 in matrix form. The method below works fine:
F = @(t,y) [
y(2);
y(3);
y(4);
t*exp(2*t)+4*y(2)-3*y(3)+12*y(1)]
y0 = [0 0 0 -1/4]';
ode45(F, [0 4], y0);
But when I try a matrix form of the system, the forcing function returns an error for an undefined t.
A = [0 1 0 0
0 0 1 0
0 0 0 1
12 4 -3 0]
b = [0 0 0 -t*exp(2*t)]'
y0 = [0 0 0 -1/4]'
F = @(t, Y, A, b) A*Y+b;
ode45(@(t,Y) F, [0,4], y0)
I've used this method for undriven systems of first-order equations. Does anyone know how to modify the code to fix the error?
2 Kommentare
Abraham Boayue
am 26 Mai 2018
It's a bit difficult to see what's going on when your original ode has been reduced to 4 systems of equations as seen in your code, especially in the form as a matrix. Could you post the original equations?
Timothy Sullivan
am 26 Mai 2018
Bearbeitet: Timothy Sullivan
am 26 Mai 2018
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!