using dsolve, ways to get particular solution only?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
David Arnold
le 12 Fév 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
le 12 Fév 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)
Réponses (1)
Mischa Kim
le 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)])
0 commentaires
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!