Info
この質問は閉じられています。 編集または回答するには再度開いてください。
PLEASE help : system of ODE
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
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 件のコメント
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!