Incorrect equilibrium values using fsolve
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Andrew Newell
2011년 5월 5일
The answer provided by fsolve looks better than yours:
>> odefun_dynamic_droop([2.6605e-07 3.6300e-06 2.5009e-06])
ans =
1.0e-06 *
0.2451
-0.0173
-0.0000
>> odefun_dynamic_droop([2.5253e-07 2.2529e-09 4.9704e-02])
ans =
1.0e-03 *
-0.0278
0.0036
-0.4970
카테고리
도움말 센터 및 File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!