Solve ODE problem
조회 수: 3 (최근 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!