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 Comment

Before you can plot anything, you must specify three initial conditions.

Sign in to comment.

 Accepted Answer

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
.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!