MATLAB: Am I getting the following errors

function errorode45

For the following code, I am getting an error and I am unable to figure out why. Any help would be handy.
%MATLAB SYMBOL DESCRIPTION IC Units
%x(1) X Cell Concentration 0.5 kmol/m3
%x(2) S Substrate Concentration 0.38 kmol/m3
%x(3) P Product Concentration 0 kmol/m3
%x(4) G Glycerol Concentration 0 kmol/m3
%x(5) V Volume 0 m3
ic = [0.5; 0.38; 0; 0; 0];
%MATLAB PARAMETER DESCRIPTION Value UNITS
%mumax mu_{max} Maximum Growth Rate 0.2 1/hour
%Ks K_s Monod Constant 2 kg/m3
%Yxs Y_{X/S} Cell Yield 0.58 kg/kg
%Ypx Y_{P/X} Product Yield 0.2 kg/kg
%Yxo Y_{X/O} Glycerol Yield
%Sf S_f Feed Substrate Concentration 0.37 kmol/m3
%Kp K_p Product Inhibition 97.9 kg/m3
mumax = 0.20;
Ks = 2;
Yxs = 0.58;
Ypx = 0.2;
Yxo = 2.46;
Sf = 0.37;
Kp = 97.9;
mu = @(S,P) (mumax*S./(Ks + S))*(1 - (P/Kp))^0.5; % Monod Equation
rg = @(X,S,P) mu(S,P)*X; % Rate of cell growth
rp = @(X,S,P) Ypx*rg(X,S,P); % Rate of ethanol formation
rpg = @(X,S,P,G) Yxo*rg(X,S,P); % Rate of glycerol formation
F = @(t) 2;
dXV = @(t, x) x(5) *rg(x(1),x(2),x(3));
dPV = @(t, x) x(5) *rp(x(1),x(2),x(3));
dSV = @(t, x) F(t)*Sf - x(5)*rg(x(1),x(2),x(3),x(4))/Yxs;
dGV = @(t, x) x(5) *rpg(x(1),x(2),x(3));
dV = @(t, x) F(t);
dX = @(t, x) (dXV(t,x) - x(1)*dV(t,x))/x(5);
dS = @(t, x, s) (dSV(t,x) - x(2)*dV(t,x))/x(5);
dP = @(t, x, p) (dPV(t,x) - x(3)*dV(t,x))/x(5);
dG = @(t, x, g) (dGV(t,x) - x(4)*dV(t,x))/x(5);
f = @(t,x) [dX(t,x); dS(t,x,s); dP(t,x,p); dG(t,x,g); dV(t,x)];
tspan = [0 100];
[t,x] = ode45(f,tspan,ic);
subplot(2,2,1);
plot(t,x(:,1));
xlabel('Time (hr)');
ylabel('X (kmol/m3)');
title('Cell Concentration');
subplot(2,2,2);
plot(t,x,s(:,3));
xlabel('Time (hr)');
ylabel('P (kmol/m3 )');
title('Product Concentration');
subplot(2,2,3);
plot(t,x,p(:,2));
xlabel('Time (hr)');
ylabel('S (kmol/m3)');
title('Substrate Concentration');
subplot(2,2,4);
plot(t,x,g(:,4));
xlabel('Time (hr)');
ylabel('V (m3)');
title('Volume');
subplot(2,2,5);
plot(t,x,g,p(:,5));
xlabel('Time (hr)');
ylabel('Glycerol Concentration (kmol/m3)');
title('Glycerol');
The error is:
Undefined function or variable 's'.
Error in @(t,x)[dX(t,x);dS(t,x,s);dP(t,x,p);dG(t,x,g);dV(t,x)]
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options,
varargin);

Best Answer

dS = @(t, x) (dSV(t,x) - x(2)*dV(t,x))/x(5);
dP = @(t, x) (dPV(t,x) - x(3)*dV(t,x))/x(5);
dG = @(t, x) (dGV(t,x) - x(4)*dV(t,x))/x(5);
f = @(t,x) [dX(t,x); dS(t,x); dP(t,x); dG(t,x); dV(t,x)];