function limCSss = steadystCsCx(Vstart,Vend,q,m0,Cx,Cs,YXS,KS)
n = 100; V = linspace(Vstart,Vend,n);
a = YXS*(q-m0*V);
b = m0*V*(Cx+Cs*YXS)-q*YXS*(Cs-KS);
c = -q*Cs*YXS*KS;
CS = (-b + (b.^2 - 4*a*c).^0.5)./(2*a);
CX = ((q*(Cs-CS)*YXS).*(KS+CS))./(m0*CS.*V);
limCSss = Cx + Cs*YXS;
ymaxCX = max(max(CX),limCSss);
yminCX = min(min(CX),limCSss);
if ymaxCX == limCSss
yCXtop = ymaxCX + 0.05*(ymaxCX-yminCX);
else,
yCXtop = ymaxCX;
end
if yminCX == limCSss
yCXbot = yminCX - 0.05*(ymaxCX-yminCX);
else
yCXbot = yminCX;
end
subplot(2,1,1)
plot(V,CS)
xlabel('V','Fontsize', 14)
ylabel('C_{S_{ss}} ','Fontsize', 14,'Rotation',0)
title([{'Anaerobic Digester Steady State Concentrations'},{' '},...
{['with q = ', num2str(q,'%5.4g'),', \mu_0 = ',num2str(m0,'%5.4g'),...
', C_{X_s} = ',num2str(Cx,'%5.4g'),', C_{S_s} = ',...
num2str(Cs,'%5.4g'),', Y_{XS} = ',num2str(YXS,'%5.4g'),...
', K_{S} = ',num2str(KS,'%5.4g')]}],'FontSize',12)
subplot(2,1,2), plot(V,CX), v = axis; axis([v(1),v(2),yCXbot,yCXtop]);
xlabel(['V ( lim C_{Sss} = ',...
num2str(limCSss,'%5.4g'),' )'],'Fontsize', 14), hold on,
plot([v(1), v(2)],[limCSss, limCSss],':r');
text(v(2),0.97*(limCSss-v(3))+v(3),' lim C_{Sss}','Fontsize',12,'Color','r'),
ylabel('C_{X_{ss}} ','Fontsize', 14,'Rotation',0), hold off