Solving an ODE second order
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have to solve an ODE second order in Matlab, like this:
a*y''(x)=b
Where x is the space coordinate, a and b are costants. The initial condition is y value at x=0. At the end I must obtain the evolution of y in function of space.
How can I model it? Should I use a certain ode solver?
Thank you!
0 件のコメント
採用された回答
Stephan
2021 年 4 月 20 日
編集済み: Stephan
2021 年 4 月 20 日
change to the initial conditions as you need:
% symbolic variables
syms a b y(x)
% Define derivatives
Dyx = diff(y,x,1)
D2yx = diff(y,x,2)
% ode
ode = a* D2yx == b
% initioal conditions
conds = [y(0)==1, Dyx(0)==0]
% solve
sol = dsolve(ode,conds)
5 件のコメント
Stephan
2021 年 4 月 20 日
Change the conds:
% symbolic variables
syms a b y(x)
% Define derivatives
Dyx = diff(y,x,1)
D2yx = diff(y,x,2)
% ode
ode = a* D2yx == b
% initioal conditions
conds = [y(0)==1, y(5)==0]
% solve
sol = dsolve(ode,conds)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!