How to set several initial conditions when solving an ODE?
조회 수: 18 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
KSSV
2017년 12월 29일
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)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!