PLotting a graph of third order differential equation

syms y(x)
eqn = 2*diff(y,x,3)+9*diff(y,x,2)+12*diff(y,x,1)+5*y == 0;
ySol = dsolve(eqn)
z = eval(vectorize(ySol));
plot(ySol,z)

1 comentario

Torsten
Torsten el 21 de Mayo de 2021
Before you can plot anything, you must specify three initial conditions.

Iniciar sesión para comentar.

 Respuesta aceptada

The initial conditions are not provided, and it is not possible to plot a function with symbolic (or otherwise undefined) parameters.
Try this —
syms y(x) y0 Dy0 D2y0
Dy = diff(y);
D2y = diff(Dy);
D3y = diff(D2y);
eqn = 2*diff(y,x,3)+9*diff(y,x,2)+12*diff(y,x,1)+5*y == 0;
ySol = dsolve(eqn, y(0)==y0, Dy(0)==Dy0, D2y(0)==D2y0)
ySol = 
ySol = subs(ySol, {y0, Dy0, D2y0},{1,2,3}) % Substitute (Or Initially Supply) Initial Conditions
ySol = 
figure
fplot(ySol, [0 10])
grid
.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 21 de Mayo de 2021

Respondida:

el 21 de Mayo de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by