Matlab plot problem line 13

1 回表示 (過去 30 日間)
Robin Torres
Robin Torres 2021 年 5 月 11 日
コメント済み: Robin Torres 2021 年 5 月 11 日
What appropriate code should i use on line 13?
syms r K E y
eqn = r*(1-y/K)*y-E*y==0;
S = solve(eqn);
y1=S(1);
y2=S(2);
dydt=@(y, E, r, k) r .* (1-y/K) .* y-E*y;
h=0.01;
E=1;
r=2;
K=1;
y = y1-h:h:subs(y2)+h;
subplot(1, 1, 1)
plot(y, dydt(y, E, r, K)) %Plot not working
title('f(y) Function')
xlabel('y')
ylabel('dy/dt')
grid on

採用された回答

VBBV
VBBV 2021 年 5 月 11 日
%if true
plot(y, double(subs(dydt(y, E, r,K))));
  2 件のコメント
VBBV
VBBV 2021 年 5 月 11 日
Change this line to above
Robin Torres
Robin Torres 2021 年 5 月 11 日
Thank you it worked

サインインしてコメントする。

その他の回答 (1 件)

Stephan
Stephan 2021 年 5 月 11 日
syms r E y K
eqn = r*(1-y/K)*y-E*y==0;
S = solve(eqn);
y1=S(1);
y2=S(2);
h=0.01;
E=1;
r=2;
K=1;
y = double(y1-h:h:subs(y2)+h);
dydt=@(y, E, r, k) r .* (1-y/K) .* y-E*y;
subplot(1, 1, 1)
plot(y, dydt(y, E, r, K)) %Plot not working
title('f(y) Function')
xlabel('y')
ylabel('dy/dt')
grid on

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by