using dsolve, ways to get particular solution only?

10 views (last 30 days)
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 Comments
David Arnold
David Arnold on 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 on 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)

Sign in to comment.

Answers (1)

Mischa Kim
Mischa Kim on 21 Oct 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)])

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!