Plot A Graph With Asymptotic Behavior

3 views (last 30 days)
Ng Swee Ping
Ng Swee Ping on 6 Apr 2019
Answered: dpb on 6 Apr 2019
function limCSss = steadystCsCx(Vstart,Vend,q,m0,Cx,Cs,YXS,KS)
% steadystCsCx(Vstart,Vend,q,m0,Cx,Cs,YXS,KS)
% sample call : steadystCsCx(10,350000,1000,.0017,800,1400,.1,32)
% Input : limits Vstart and Vend for the volume;
% system parameters q, m0, Cx, Cf, YXS, and KS
% Output : two plots of CSss(V) and CXss(V)
n = 100; V = linspace(Vstart,Vend,n); % initialize
a = YXS*(q-m0*V); % quadratic polynomial coeff.
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); % CSss data
CX = ((q*(Cs-CS)*YXS).*(KS+CS))./(m0*CS.*V);
limCSss = Cx + Cs*YXS; % finding optimal CXss plot region limits :
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'); % asymtotic line
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
ymaxCX = max(max(CX),limCSss); yminCX = min(min(CX), limCSss);
From this sentence, what does it means to?

Answers (1)

dpb
dpb on 6 Apr 2019
ymaxCX = max(max(CX), limCSss);
yminCX = min(min(CX), limCSss);
Just getting an overall min/max value of the data in vector CX and the computed limit for setting axis xlim values it would appear (altho you need to read the terribly poorly formatted code extremely carefully to be able to find just where that usage actualy is...)

Categories

Find more on 2-D and 3-D Plots 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!