Solve ODE problem
5 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Aidin
on 4 May 2012
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 Comments
Jan
on 4 May 2012
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 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!