Solve ODE problem
5 ビュー (過去 30 日間)
古いコメントを表示
Hi everybody,
I am new to Matlab and would request some help with numerically solving an ODE. The equations themselves are very simple as given below:
2y''' + yy''=0
--------------------------------------
%My fuction
function dy = rigid(t,y)
dy = zeros(3,1);
dy(1) = y(2);
dy(2) = y(3);
dy(3) = (y(2) * y(3))/2;
end
--------------------------------------
Now i use ode45:
[T,Y] = ode45(@rigid,[0 3],[0 0 1])
But the problem is because my initial conditions are:
y1(0)=0
y2(0)=0
y2(inf)=1
The vector about initial conditions at edo45 are [ 0 0 1 ] thats means: y1(0)=0, y2(0)=0, y3(0)=0.
So, how i write y2(inf)=1??
Any help will be appreciated!
Thank you.
0 件のコメント
回答 (2 件)
Aidin
2012 年 5 月 4 日
Hi,
You need to decide a step length in time and space (dt and dx etc) and then define the size of y1, y2 and y3 similar as how you do with dy with zeros depending on the step length. When this is done you can set y2(end)=1 which will set the last element in y2 equal to one.
good luck
0 件のコメント
Jan
2012 年 5 月 4 日
A solver for an ODE accepts the initial conditions. When you define the time in backward direction, this means that in the time interval [a, b] a is greater than b, you can define the final conditions also. But you cannot define both.
Anyhow, the final time Inf will be hard to express, because you need an infinite number of steps. A mathematical transformation is most likely helpful to remove the infinity.
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!