Hi!
I'm using fsolve to find equilibrium values of a series of three differential equations ( the Droop model). I've been using fsolve and getting weird equilibrium values, so I went back and solved the equations by hand and fsolve has been giving me incorrect values. The script I've been using is below and I've been using this command in the Command Window:
fsolve(@odefun_dynamic_droop, [1, 1, 1])
I've tried various x0 values but that doesn't seem to change things. For the parameter values in the script, fsolve finds zeros at
2.6605e-07 3.6300e-06 2.5009e-06
when I calculate
2.5253e-07 2.2529e-09 4.9704e-02
Are there options I can change or something to make fsolve more accurate? I haven't entered the parameters or equations wrong.
Thank you!
Code:
function x_prime = odefun_dynamic_droop(x)%flow rate parameter
F = 0.01; %flow rate
%fixed parameters
S = 2.5e-6; %initial substrate concentration
p_max = 3.38e-6; %max intake rate of nutrient (P) by algae
K_p = 1.29e-8; %half saturation constant of nutrient intake by algae
u_Amax = 1; %apparent max growth rate
Q_Amin = 2.5e-7; %subsistence quote for algae
% Get state variables from x
N_A = x(1);Q_A = x(2);R = x(3);%functions
M_A = F * N_A;p = (p_max * R) / (K_p + R);I_R = N_A * p;r_A = u_Amax * N_A * ((Q_A - Q_Amin) / Q_A);% differential equations
N_A_prime = r_A - M_A;Q_A_prime = p - ((Q_A - Q_Amin) * u_Amax);R_prime = (F * S) - (F * R) - I_R;% Return derivatives in a single column vector
x_prime = [N_A_prime; Q_A_prime; R_prime];end
Best Answer