Two different solutions for one differential equation (population model)
2 ビュー (過去 30 日間)
古いコメントを表示
Niklas Kurz
2021 年 5 月 29 日
コメント済み: Sulaymon Eshkabilov
2021 年 6 月 3 日
I'll try solving the ODE:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634675/image.png)
Substituting ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634680/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634680/image.png)
Transforming to: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634685/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634685/image.png)
Solving I get: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634690/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634690/image.png)
Finally, after back substitution: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634695/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634695/image.png)
complete solution: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634700/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634700/image.png)
what's equivalent to: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634705/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634705/image.png)
Now same stuff with MATLAB:
syms u(t); syms c1 c2 u0 real;
D = diff(u,t,1) == c1*u-c2*u^2;
k2 = u;
cond = k2(0) == u0;
S = dsolve(D,cond);
pretty(S)
Receiving: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634710/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/634710/image.png)
I was hoping these expressions have some equivalence so I was plotting them:
c1 = 4; c2 = 2; u0 = 1;
syms t
P1 = (c1)/(1-exp(-c1*t)+c1/u0*exp(-c1*t));
fplot(P1)
hold on
P2 = -(c1*(tanh(atanh((c1 - 2*c2*u0)/k1) - (c1*t)/2) - 1))/(2*c2);
fplot(P2)
but no luck there. I know that's again a quite complex question, but on MathStack one told me these solutions are equvialent, so I don't see a reason for the dissonance.
3 件のコメント
Sulaymon Eshkabilov
2021 年 6 月 3 日
Most welcome. We learn by making mistakes.
Please just keep it. So others can learn.
採用された回答
Sulaymon Eshkabilov
2021 年 5 月 29 日
Besides k1, in your derivations, there are some errs. Here are the corrected formulation in your derivation part:
c1 = 4; c2 = 2; u0 = 1;
syms t
P1 = c1/(c2 - exp(-c1*t)*(c2 - c1/u0)); % Corrected one!
fplot(P1, [0, pi], 'go-')
hold on
P2 = -(c1*(tanh(atanh((c1 - 2*c2*u0)/c1) - (c1*t)/2) - 1))/(2*c2);
S = eval(S);
fplot(S, [0, pi], 'r-')
Good luck.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!