Wrong answer for ODE
古いコメントを表示
MATLAB is giving the wrong answer to my ordinary differential equation.
m*diff(v) + p*v(t) == -g*m
The solution I am getting by solving it by hand is
C*exp(-(p*t)/m) - (g*m)/p
This is part of my code:
syms v(t) p m g
sol = dsolve (m*diff(v) + p*v(t) == -g*m)
MATLAB says:
sol =
(C4*exp(-(p*t)/m) - g*m)/p
What am I doing wrong?
3 件のコメント
Umer
2023 年 4 月 29 日
Image Analyst
2023 年 4 月 29 日
編集済み: Image Analyst
2023 年 4 月 29 日
How did you get the one you got by hand? Why is your exp() not divided by p? Is p a constant? If so then it could be bundled into the constant.


Umer
2023 年 4 月 29 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

