Implement for loop in ode45 solver
Show older comments
I'm trying to vary parameter.D with a for loop so i can use the ode45 solver for different values of parameter.D
parameter.mumax = 0.42; %1/h
parameter.Km = 0.25; %g/l
parameter.Sin = 60; %g/l
parameter.Yxs = 0.25; %g/g
parameter.D = 0.1:0.1:0.5;%1/h
y0 = [ 5, 60]; %biomass substrate
tspan = [0 100]; %h
options = odeset('RelTol', 1e-6);
[t,y] = ode45(@biomassproductionmodel, tspan, y0, options, parameter);
function [dydt] = biomassproductionmodel(t,y, parameter)
mu = parameter.mumax*y(2)/(parameter.Km+y(2));
dydt(1,1) = mu*y(1) - parameter.D*y(1);
dydt(2,1) = -mu*y(1)/parameter.Yxs + parameter.D*(parameter.Sin - y(2));
end
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
