displaying values in command window
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
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
2013 年 8 月 5 日
display(Vb')
display(pH')
% or you can display them together
[Vb' pH']
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!