third order differential equation with matlab

13 visualizaciones (últimos 30 días)
hamad alshammari
hamad alshammari el 8 de Oct. de 2018
Respondida: Star Strider el 9 de Oct. de 2018
hi i want to solve third order differential equation with matlab y'''+6y''+28y'+40y= cos (4t) where y(0)=1 , y'(0)=1 , y''(0)=0 thanks in advance
  1 comentario
John D'Errico
John D'Errico el 8 de Oct. de 2018
Read the help for the ODE tools. Start with
doc ode45
You might be surprised, and find they teach you to do virtually exactly what you need to do. But if you never read the help, then you ask us to re-write the help docs, just so that you can read what we wrote. That would be silly.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 9 de Oct. de 2018
If you are using the Symbolic Math Toolbox, solving it is something of a challenge. This is a linear differential equation:
% y''' + 6y'' + 28y' + 40y = cos(4t)
syms s t y(t) Y
Dy = diff(y);
D2y = diff(y,2);
D3y = diff(y,3);
Eqn = D3y + 6*D2y + 40*y == cos(4*t);
LEqn = laplace(Eqn)
LEqn = subs(LEqn, {laplace(y(t), t, s), subs(diff(y(t), t), t, 0), subs(diff(y(t), t, t), t, 0)}, {Y, 1, 0})
Ysol = solve(LEqn, Y)
Ysol = subs(Ysol, {y(0)}, {1})
Y = vpa(ilaplace(Ysol))
figure
fplot(Y, [0 3*pi])
grid
This seems to be an unstable system, so check it to be certain.
Since this is likely homework, I present this solution because using Laplace transforms in MATLAB to solve differential equations is not as straightforward as it might be. (The dsolve function apparently just gets lost.) I would not expect those who have not previously encountered these problems to be able to deal with them effectively.
Of course, you can always simply cut to the chase and use the odeToVectorField and matlabFunction functions, using the result with the numerical solvers. That is obviously easier.
Your choice.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by