Solve ODE problem
显示 更早的评论
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.
回答(2 个)
Aidin
2012-5-4
0 个投票
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
Jan
2012-5-4
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!