displaying values in command window

2 ビュー (過去 30 日間)
harley
harley 2013 年 8 月 5 日
follow script, how do i display the value of Vb and pH when "abs(M_excess)<eps" and following that how would i plot that point a figure.
Kw = 1e-14;
Ka = 1.755388e-5;
pKa = 4.756;
%
Ca = 0.5;
Cb = 0.1;
Va = 100;
Vb = 0.05:0.05:2000;
%
% This simulates initial molarity of CH3CO2H.
Ma = (Ca * Va) / 1000;
% This simulates initial molarity of NaOH.
Mb = (Cb .* Vb) ./ 1000;
for i = 1:length(Mb)
M_excess = Ma - Mb(i);
if abs(M_excess)<eps
Hplus = Ka * ((Ma_final * 0.999999) ./ Mb_final);
elseif M_excess > 0
Ma_final = (M_excess * 1000) ./ (Va + Vb(i));
Mb_final = (Mb(i) * 1000) ./ (Va + Vb(i));
Hplus = Ka * (Ma_final ./ Mb_final);
elseif M_excess < 0
OH = (M_excess * 1000 * (-1)) ./ (Va + Vb(i));
Hplus = Kw ./ OH;
end
pH(i) = -log10(Hplus);
end

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 5 日
for i = 1:length(Mb)
M_excess = Ma - Mb(i);
v=[];
if abs(M_excess)<eps
Hplus = Ka * ((Ma_final * 0.999999) ./ Mb_final);
v(end+1)=Hplus,
elseif M_excess > 0
Ma_final = (M_excess * 1000) ./ (Va + Vb(i));
Mb_final = (Mb(i) * 1000) ./ (Va + Vb(i));
Hplus = Ka * (Ma_final ./ Mb_final);
elseif M_excess < 0
OH = (M_excess * 1000 * (-1)) ./ (Va + Vb(i));
Hplus = Kw ./ OH;
end
pH(i) = -log10(Hplus);
end
display(v)
  5 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 5 日
display(Vb')
display(pH')
% or you can display them together
[Vb' pH']
harley
harley 2013 年 8 月 5 日
編集済み: Azzi Abdelmalek 2013 年 8 月 5 日
i think i got it to work Azzi. Thanks for your help, its been great.
for i = 1:length(Mb)
M_excess = Ma - Mb(i);
if abs(M_excess)<eps
Hplus = Ka * ((Ma_final * 0.999999) ./ Mb_final);
pH_ev = pH(end);
Vb_ev = Vb(i);
elseif M_excess > 0
Ma_final = (M_excess * 1000) ./ (Va + Vb(i));
Mb_final = (Mb(i) * 1000) ./ (Va + Vb(i));
Hplus = Ka * (Ma_final ./ Mb_final);
elseif M_excess < 0
OH = (M_excess * 1000 * (-1)) ./ (Va + Vb(i));
Hplus = Kw ./ OH;
end
pH(i) = -log10(Hplus);
end
% OUTPUT SECTION
disp('The Volume of Base NaOH at Equivalence is:')
disp(Vb_ev)
disp('The pH at Equivalence is:')
disp(pH_ev)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by