Calculating growth using ODE 45 from t=0 to t=100

4 次查看(过去 30 天)
Hello, I need help with my code using ODE 45. Can someone help me check my code?
t = 0:0.01:100;
r = [0.05 0.1 0.5 1 10];
k = 15;
B0 = 1;
B = @(x,y) 30-x.^2-5*(cos((x.*y)/5)).^2;
colourmap = [228 26 28; 55 126 184; 77 175 74; ...
152 78 163; 255 127 0]/255;
z = zeros(length(t),length(r));
T = zeros(length(t),length(r));
%
for i = 1:length(r)
dBdt = @(B) r.*B*(1-B./k);
[z,T] = ode45(dBdt,tspan, B0);
plotting
figure(6) %figure 6
loglog(t,T,'-','color',colourmap(i,:))
hold on
grid on
end

回答(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