How to set several initial conditions when solving an ODE?

4 visualizzazioni (ultimi 30 giorni)
Hi, I have the following ODE:
if true
% code
end
syms a h Y(x) g x B E
eqn = (h)*diff(Y,x, 2) + (g)*diff(Y,x) + (g^2 - E)*Y == 0;
cond = Y(0) == 1;
cond = (diff(Y)(0) == 0;
Y(x) = dsolve(eqn, cond)
and would like to add Y'(0)= 0 as initial condition, however cond = (diff(Y)(0) == 0; does not work. How can I combine two conditions here?
Thanks!

Risposta accettata

KSSV
KSSV il 29 Dic 2017
Check this demo from the documentation:
syms y(t) a b
eqn = diff(y,t,2) == a^2*y;
Dy = diff(y,t);
cond = [y(0)==b, Dy(0)==1];
ySol(t) = dsolve(eqn,cond)
  1 Commento
Sergio Manzetti
Sergio Manzetti il 29 Dic 2017
Hi KSSV, I did this and it worked, however I am puzzled given that I still get a constant "C11" in the answer, when two conditions are given. Is this a typical example where further conditions are required to get "rid of" C11?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by