![Screen Shot 2018-11-15 at 11.17.17 AM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195105/Screen%20Shot%202018-11-15%20at%2011.17.17%20AM.png)
Solving the Ordinary Differential Equation
1 次查看(过去 30 天)
显示 更早的评论
I am not sure how to solve these systems of differential equation. However, the final graph representation of the result is two exponential curves for
and
in respect to time.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195097/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195098/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195099/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195100/image.png)
Also, with
=
, the variable ks and BP are all constant.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195102/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195103/image.png)
0 个评论
采纳的回答
madhan ravi
2018-11-15
编辑:madhan ravi
2018-11-15
EDITED
use dsolve()
or
Alternate method using ode45:
![Screen Shot 2018-11-15 at 11.17.17 AM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195105/Screen%20Shot%202018-11-15%20at%2011.17.17%20AM.png)
tspan=[0 1];
y0=[0;0];
[t,x]=ode45(@myod,tspan,y0)
plot(t,x)
lgd=legend('Cp(t)','Cr(t)')
lgd.FontSize=20
function dxdt=myod(t,x)
tau=2;
ks=3;
BP=6;
k1=5;
k2=7;
x(1)=exp(-t)/tau; %x(1)->Cp
dxdt=zeros(2,1);
dxdt(1)=k1*x(1)-(k2/(1+BP))*x(2); %x(2)->Cr
dxdt(2)=k1*x(1)-k2*x(2);
end
9 个评论
madhan ravi
2018-11-15
编辑:madhan ravi
2018-11-15
Anytime :), It is called preallocation(please google it) imagine as a container to store something. Make sure to accept for the answer if it was helpful.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!