Two different solutions for one differential equation (population model)

조회 수: 3 (최근 30일)
I'll try solving the ODE:
Substituting
Transforming to:
Solving I get:
Finally, after back substitution:
complete solution:
what's equivalent to:
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:
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
Niklas Kurz
Niklas Kurz 2021년 5월 29일
편집: Niklas Kurz 2021년 5월 29일
Oh my gosh, all the trouble and questionings were caused by a little typo. I really cherish that hint. It's worth a reply for sure hence I can accept and close the question. Or should I delete it since it's not others people buiseness?
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 3일
Most welcome. We learn by making mistakes.
Please just keep it. So others can learn.

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

채택된 답변

Sulaymon Eshkabilov
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개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by