Matlab plot problem line 13

1 次查看(过去 30 天)
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))));

更多回答(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 CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by