Problems with coupled ODEs in order to solve them numerical

조회 수: 2 (최근 30일)
betlor5
betlor5 2011년 5월 19일
Hi,
I am still stuck on a problem I have and I can't find the solution.
How do I use the ode45 function in order to solve the following ODEs numerical?
y'(x) + y(x) = 5
f'(x) = -y'(x)
with the initial values
y(0) = 0 and f(0) = 1
It isn't a problem to solve it analytical. This would be
y(x) = 5 - 5 exp(-x)
f(x) = 5 exp(-x) - 4
I hope you can help me with a code solution. Because if I try to input it in Matlab in the form of an Matrix M with
z' = M*z + b with z = (y(x), y'(x), f(x)) and b = (5, 0 ,0 )
I would need an initual value for y' as well as for the other two parameters.
  댓글 수: 1
Andrew Newell
Andrew Newell 2011년 5월 20일
I think you need to figure out how to classify your equations before getting help on the MATLAB implementation. If you can't find some standard form for them, your problem may be ill-formed and there may be no solution.

댓글을 달려면 로그인하십시오.

답변 (2개)

Andrew Newell
Andrew Newell 2011년 5월 19일
You could reformulated it as
y'(x) = -y(x) + 5
f'(x) = y(x) - 5
with the initial values y(0) = 0 and f(0) = 1. Then create a vector v = [y f].
vp = @(~,v) [-v(1)+5; v(1)-5];
v0 = [0; 1];
tspan = [0 10];
[T,Y] = ode45(vp,[0 10],v0);
plot(T,Y,T,5-5*exp(-T),'o',T,-4+5*exp(-T),'+')
  댓글 수: 2
betlor5
betlor5 2011년 5월 19일
My Point is not to reformulate it. I explicity came up with an easy equation in order to have a good example on how to see a general way of solving a coupled equation. This is necessary in order to solve a more complexed system, which I can not reformulate. An other aspect on this example was that I could compare the diffrent numerical solvers with the allready known solution. Therefore I hope there is an possibility. If it is necessary I can come up with a more sophisticated system to demonstrate my problem.
Arnaud Miege
Arnaud Miege 2011년 5월 20일
If you look at the documentation for the ode solvers (http://www.mathworks.com/help/releases/R2011a/techdoc/ref/ode23.html), they solve equations in the form of dy/dt = f(y,t) or problems that involve a mass matrix M(t,y) * dy/dt = f(t,y). You therefore need to be able to express your differential equations in one of these two forms

댓글을 달려면 로그인하십시오.


betlor5
betlor5 2011년 5월 20일
Isn't there an other way?

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by