using dsolve, ways to get particular solution only?

7 Ansichten (letzte 30 Tage)
R. Paul Borthwick
R. Paul Borthwick am 21 Okt. 2014
Kommentiert: Walter Roberson am 12 Feb. 2018
I am teaching an undergraduate Ordinary Differential Equations Class.
Working with non-homogeneous equations, (second order, linear)
Want to use dsolve to get a particular solution only.
Specifically:
sol=dsolve('D2y-5*Dy+6*y==exp(t)*cos(2*t)+exp(2*t)*(3*t+4)*sin(t)','t')
When executed, we get a result of both complimentary and particular solution.
Is there anyway to configure dsolve to present only the particular solution?
Thanks Paul
  2 Kommentare
David Arnold
David Arnold am 12 Feb. 2018
I just tried this:
syms t y(t)
sol=dsolve(diff(y,t,2)-5*diff(y,t)+6*y==exp(t)*cos(2*t)+exp(2*t)*(3*t+4)*sin(t),t);
sol=simplify(sol);
yp=subs(sol,symvar(sol),[0,0,t])
Walter Roberson
Walter Roberson am 12 Feb. 2018
When you use the syms version as David shows, then in some situations it can help to add assumptions to variables. For example
syms y(t)
syms t nonnegative
syms B
assume(B>1)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Mischa Kim
Mischa Kim am 21 Okt. 2014
Paul, I am not aware of a setting that would allow you to print the particular solution, only.
You can, however, eliminate the general solution by hand. E.g.,
sol = dsolve('D2y-5*Dy+6*y==exp(t)*cos(2*t)+exp(2*t)*(3*t+4)*sin(t)','t')
sv = symvar(sol);
sol_par = subs(sol,sv,[zeros(1,numel(sv)-1) sv(3)])

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by