Why i call this function of equation? help with fsolve. thanks

2 views (last 30 days)
S_IT = 51.2e-4;
S_ID = 8.2e-4;
S_IE = 520e-4;
BW = 53;
tau_G = 40;
tau_I = 55;
A_G = 0.8;
k_12 = 0.066;
k_a1 = 0.006;
k_b1 = S_IT*k_a1;
k_a2 = 0.06;
k_b2 = S_ID*k_a2;
k_a3 = 0.03;
k_b3 = S_IE*k_a3;
k_e = 0.138;
V_I = 0.12*BW;
V_G = 0.16*BW;
F_01 = 0.0097*BW;
EGP_0 = 0.0161*BW;
%u = 0.0954119*BW;
r = 5; %[mmol/L]
%U_G=y(2)/tau_G;
%U_I=y(4)/tau_I;
G= y(11)/V_G;
D = 0;
if(G>=4.5)
F_01c=F_01;
else
F_01c=F_01*G/4.5;
end
if(G>=9)
F_R=0.003*(G-9)*V_G;
else
F_R=0;
end
f1=(A_G*D)-(y(1)/tau_G); %D1
f2=(y(1)/tau_G)-(y(2)/tau_G); %D2
f3=y(3)-(y(4)/tau_I); %u & S1
f4=(y(4)/tau_I)-(y(5)/tau_I); %S2
f5=((y(5)/tau_I)/V_I)-(k_e*y(6)); %I
f6=(k_b1*y(6))-(k_a1*y(7)); %x1
f7=(k_b2*y(6))-(k_a2*y(8)); %x2
f8=(k_b3*y(6))-(k_a3*y(9)); %x3
f9=(y(7)*y(11))-((k_12+y(8))*y(10)); %Q2
f10=-(F_01c+F_R)-(y(7)*y(11))+(k_12*y(10))+(y(2)/tau_G)+(EGP_0*(1-y(9))); %Q1
f11=(y(11)/V_G)-r;
%f6=y(9)*y(5)-(k_12+y(10))*y(6); %Q2
%f7=y(4)/tau_I/V_I-k_e*y(7); %I
%f8=k_b1*y(7)-k_a1*y(8); %x1
%f9=k_b2*y(7)-k_a2*y(9); %x2
%f10=k_b3*y(7)-k_a3*y(10); %x3
F = [f1;f2;f3;f4;f5;f6;f7;f8;f9;f10;f11];
2nd script
y0 = [0 0 0 0 0 0 0 0 0 0 0];
options=optimset('Display','off');
y = fsolve(@function_hovorka_,y0,options);

Accepted Answer

Walter Roberson
Walter Roberson on 23 Nov 2016
That first bit of code needs to be stored in a file named function_hovorka_.m and you need to add at the very beginning
function F = function_hovorka_(y)

More Answers (0)

Categories

Find more on Manage Products 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!