Filter löschen
Filter löschen

How to print the solution of ODE solved by using dsolve along with a plot.

3 Ansichten (letzte 30 Tage)
Madhav
Madhav am 8 Sep. 2022
Bearbeitet: Torsten am 8 Sep. 2022
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)
xSol(t) = 

Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by