Plotting curves using loops?
显示 更早的评论
I'm trying to figure out a simple code to plot supersaturation values against the size of a particle. I have everything I need, just having trouble plotting multiple values for the radius. I'm using a loop as it seems the most logical when plotting so many values.
T = 293;
k = 1.38*10^-23;
o = 75.64*10^-3;
n = 3.348*10^28;
Ms = .13214;
Mw = .018;
p = 1769;
i = 3;
m=10^-16;
EIndex = 1
for r = 0.01:100
E(EIndex) = (exp((2*o)/(n*k*T*r)))*((1+((i*m*Mw)/(Ms*(((4/3)*pi*(r^3)*p)-m))))^-1)
EIndex = EIndex + 1
S(EIndex)=100*E - 100;
end
semilogx(S)
xlim([0.01 100])
ylim([-1.5 0.5])
I've tried various setups and get error such as "indices need to be positive" or the current "In an assignment A(:) = B, the number of elements in A and B must be the same."
Simply put I want to
- plot values for r (radius) on the x axis logarithmic from .01 - 100
- plot values for S (supersaturation) on the y axis linearly from 80-100.5%
The end result should look like a Kohler curve similar to below

Any help would be greatly appreciated!
1 个评论
Jakub Bialek
2016-11-18
Tiki did you manage to produce similar graphs for your AS solution? I mean for different Dp... How do oyu specify Dp?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
