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

2 visualizaciones (últimos 30 días)
Faris Amzar Mohamad Azrai
Faris Amzar Mohamad Azrai el 3 de Jun. de 2020
Comentada: James Tursa el 3 de Jun. de 2020
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

Respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by