plot graphs with a range

10 ビュー (過去 30 日間)
Seungryul Lee
Seungryul Lee 2022 年 9 月 27 日
回答済み: Chunru 2022 年 9 月 27 日
Hi, I have an equilibrium function, and I want to plot graphs of the equilibrium outputs as a function of temperature in a specific range.
R = 2.303 * 8.314;
T = 273 + 20;
F = 96500;
Eqv = @(z, Xout, Xin) ((R * T) / (z * F)) * log(Xout/Xin);
fprintf("<Question 1: Calculating the equilibrium potentials for ions at a temperature of 20>\n")
fprintf("(a) Equilibrium potential for K+")
Eqv(1,5,150)
fprintf("(b) Equilibrium potential for Na+")
Eqv(1,150,15)
fprintf("(c) Equilibrium potential for Cl-")
Eqv(1,125,10)
fprintf("(d) Equilibrium potential for Ca2+")
Eqv(2,2,0.0002)
This is the code for the equilibruim values of different ions, and I want to plot graphs of the equilibrium values(for each ions) as a function of temperature in the range of 283k to 313k.
Please help! Thank you.

採用された回答

Chunru
Chunru 2022 年 9 月 27 日
R = 2.303 * 8.314;
T = 273 + 20;
F = 96500;
Eqv = @(z, Xout, Xin) ((R * T) / (z * F)) * log(Xout/Xin);
fprintf("<Question 1: Calculating the equilibrium potentials for ions at a temperature of 20>\n")
<Question 1: Calculating the equilibrium potentials for ions at a temperature of 20>
fprintf("(a) Equilibrium potential for K+")
(a) Equilibrium potential for K+
Eqv(1,5,150)
ans = -0.1977
fprintf("(b) Equilibrium potential for Na+")
(b) Equilibrium potential for Na+
Eqv(1,150,15)
ans = 0.1339
fprintf("(c) Equilibrium potential for Cl-")
(c) Equilibrium potential for Cl-
Eqv(1,125,10)
ans = 0.1468
fprintf("(d) Equilibrium potential for Ca2+")
(d) Equilibrium potential for Ca2+
Eqv(2,2,0.0002)
ans = 0.2677
para = [ 1, 5, 150;
1, 150,15;
1, 125,10;
2, 2, 0.0002];
Eqv = @(T, z, Xout, Xin) ((R * T) / (z * F)) * log(Xout/Xin);
T = (283:313);
for i=1:height(para)
subplot(2, 2, i);
plot(T, Eqv(T, para(i,1), para(i,2), para(i,3)))
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by