Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

PLEASE help : system of ODE

조회 수: 1 (최근 30일)
Arun Maari Rajha K V
Arun Maari Rajha K V 2011년 8월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
I have system of five differential equations with initial conditions. They are as follows. Kindly help me solve them.
Dx=((((0.4*a)/(a*(0.029*x)))*(0.668/(b+0.668)))-((1/v)*0.01))*x
Da=((0.01/v)*50)-(((((2/5)+(13*0.13)+(3*0.051)+(3*2.62))*(0.01/v))+(3*0.188))*x)-((0.01/v)*a)
Db=(2*(((0.051+(2*(0.13-(1/20)))+2.62)*(0.1/v))+0.188))-((0.01/v)*b)
Dc=((6*(0.13-(1/20)))*(0.01/v))-((0.01/v)*c)
Dv=0.01
the initial conditions are as follows:
x(0)=4.41
a(0)=0
b(0)=22.68
c(0)=1.28
v(0)=1

답변 (1개)

Friedrich
Friedrich 2011년 8월 5일
Hi,
Based on this article (chapter 2.3)
I think you have to do it like this:
function my_func()
start_cond = [4.41, 0, 22.68, 1.28, 1];
tspan = [0,20];
[t,x] = ode45(@func,tspan,start_cond);
plot(t,x);
function out = func(t,x)
%x(1) is variable x
%x(2) is variable a
%x(3) is variable b
%x(4) is variable c
%x(5) is variable v
out = zeros(size(x));
out(1) = ((((0.4*x(2))/(x(2)*(0.029*x(1))))*(0.668/(x(3)+0.668)))-((1/x(5))*0.01))*x(1);
out(2) = ((0.01/x(5))*50)-(((((2/5)+(13*0.13)+(3*0.051)+(3*2.62))*(0.01/x(5)))+(3*0.188))*x(1))-((0.01/x(5))*x(2));
out(3) = (2*(((0.051+(2*(0.13-(1/20)))+2.62)*(0.1/x(5)))+0.188))-((0.01/x(5))*x(3));
out(4) = ((6*(0.13-(1/20)))*(0.01/x(5)))-((0.01/x(5))*x(4));
out(5) = 0.01;
end
Please double check the code for typos in regard of the x(1,...5) convertion!
  댓글 수: 4
Arun Maari Rajha K V
Arun Maari Rajha K V 2011년 8월 5일
could you kindly show me how to do it sir?
Friedrich
Friedrich 2011년 8월 5일
Acording to the doc I would say like this:
out = dsolve('Dx=((((0.4*a)/(a*(0.029*x)))*(0.668/(b+0.668)))-((1/v)*0.01))*x',...
'Da=((0.01/v)*50)-(((((2/5)+(13*0.13)+(3*0.051)+(3*2.62))*(0.01/v))+(3*0.188))*x)-((0.01/v)*a)',...
'Db=(2*(((0.051+(2*(0.13-(1/20)))+2.62)*(0.1/v))+0.188))-((0.01/v)*b)',...
'Dc=((6*(0.13-(1/20)))*(0.01/v))-((0.01/v)*c)',...
'Dv=0.01','x(0)=4.41','a(0)=0','b(0)=22.68','c(0)=1.28','v(0)=1')
But I get an error which I don't understand. Than I tried it without the initial conditions:
out = dsolve('Dx=((((0.4*a)/(a*(0.029*x)))*(0.668/(b+0.668)))-((1/v)*0.01))*x',...
'Da=((0.01/v)*50)-(((((2/5)+(13*0.13)+(3*0.051)+(3*2.62))*(0.01/v))+(3*0.188))*x)-((0.01/v)*a)',...
'Db=(2*(((0.051+(2*(0.13-(1/20)))+2.62)*(0.1/v))+0.188))-((0.01/v)*b)',...
'Dc=((6*(0.13-(1/20)))*(0.01/v))-((0.01/v)*c)',...
'Dv=0.01')
which worked fine. The result for b,c,v looks good. x and a looking very complicated. You have to calculate the unknown C** variables afterwards. Since you have the initial conditions this should be possible but totally ugly.
Why not using the numerically solution? Its faster and easier to handle.

Community Treasure Hunt

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

Start Hunting!

Translated by