How to print the solution of ODE solved by using dsolve along with a plot.
3 views (last 30 days)
Show older comments
Use "subs" to substitute values for c,m,k,x0 and v0. Then you will be able to plot.
If you have problems, consult the dsolve documentation.
syms x(t) c m k x0 v0
Dx = diff(x);
ode = diff(x,t,2) == (-c/m)*diff(x,t)+(-k/m)*x;
initialcond1 = x(0) == x0;
initialcond2 = Dx(0) == v0;
conditions = [initialcond1 initialcond2];
xSol(t) = dsolve(ode,conditions);
xSol = simplify(xSol)
0 Comments
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!