I'm trying to solve a simple differential equation, which works with no problem, but when trying to plot it only ezplot seems to be working, no luck with fplot
syms y(t)
a = 1;
b = 10;
D = diff(y,t) == -a * y * log(y/b);
C = y(0) == 5;
psolution = dsolve(D,C)
gsolution = dsolve(D)
fplot(psolution)
It's really nothing too fancy but I don't understand what's going wrong. This is the output:

回答 (1 件)

Star Strider
Star Strider 2020 年 7 月 25 日
編集済み: Star Strider 2020 年 7 月 25 日

0 投票

Try this:
figure
fplot(real(psolution))
hold on
fplot(imag(psolution))
hold off
grid
set(gca, 'YScale','log', 'Ylim',[min(ylim) 100])
legend('Re','Im')
The rest of your code is unchanged.
EDIT — (25 Jul 2020 at 01:07)
Added plot image:
.

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

製品

リリース

R2019b

質問済み:

2020 年 7 月 24 日

編集済み:

2020 年 7 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by