MATLAB: Not enough input arguments

not enough arguments

Can you please help me in this error:
Not enough input arguments.
Error in eqs>eqs1 (line 46)
fcns(1) = F1- (r1*f1^2 + f1*(1-f1))/(r1*f1^2 + 2*f1*(1-f1) + r2*(1-f1)^2);
Error in fsolve (line 242)
fuser = feval(funfcn{3},x,varargin{:});
Error in eqs (line 41)
result = fsolve(@eqs1,guess)
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
Program:
%global V F1in F2in Mw1 Mw2 Rho1 Rho2 Io f k11 r1 k22 r2 kt kd k12 k21 Vout TotalFin Pdot Residencetime
clc;
close all;
V = input('Please enter the vol of reactor (m3)');
F1in = input('Please enter the molar flow rate of Monomer_1 (mol/s)');
F2in = input(' Enter the molar flow rate of Monomer_2 (mol/s)');
Mw1 = input('Enter the molar mass of Monomer_1 (g/gmol)');
Mw2 = input(' Enter the molar mass of Monomer_2 (g/gmol)');
Rho1 = input('Enter the density of Monomer_1 (g/cm3)');
Rho2 = input('Enter the density of Monomer_2 (g/cm3)');
Io = input(' Enter the initial concentration of initiator (mol/m3)');
f = input(' Enter the initiator efficency');
k11 = input(' Enter the value of k11');
r1 = input('Enter the value of r1');
k22= input('Enter the value of k22');
r2 = input('Enter the value of r2');
kt= input('Enter the value of kt');
kd= input('Enter the value of kd');
k12 = k11/r1;
k21= k22/r2;
Vout = ( (F1in*Mw1)/Rho1 ) + ( (F2in*Mw2)/Rho2 );
TotalFin = F1in + F2in ;
Pdot = ( (f*kd*Io)/kt )^0.5;
Residencetime = V/Vout;
guess = [0.1 0.02];
result = fsolve(@eqs1,guess)
function fcns = eqs1(z,r1,r2,TotalFin,Residencetime,Pdot,k11,k22,k12,k21)
F1 = z(1);
f1 = z(2);
fcns(1) = F1- (r1*f1^2 + f1*(1-f1))/(r1*f1^2 + 2*f1*(1-f1) + r2*(1-f1)^2);
fcns(2) = TotalFin/(TotalFin - 31.71/(104-51*F1)) - ((Residencetime*Pdot)*(k11*k22*f1^2 + 2*k21*k12*f1 - 2*k21*k12*f1^2 + k22*k12 + k22*k12*f1^2 - 2*k22*k12*f1))/(k12*(1-f1) + k21*f1) -1 ;
end

Best Answer

You need to pass all the arguments to ‘eqs1’ in your fsolve call.
Try this instead:
result = fsolve(@(z)eqs1(z,r1,r2,TotalFin,Residencetime,Pdot,k11,k22,k12,k21),guess)