Increase a variable by 0.1 each iteration
显示 更早的评论
I have created code to find Scrit and Dmax for a series of Dd values, but each iteration seems to increase by a random amount - I need it to increase by 0.1 each time? I believe I need to edit the line i=0.01:0.1:1?
I would also like to be able to save each iteration table in a new excel row, but at the moment the code just overwrites into the first row of my excel spreadsheet?
T=table(Dd, Scrit, Dmax)
filename='Dry diameter.xls';
writetable(T,filename)
- do I need to edit this to new column each run, if so how?
Here is the code:
% Using dry diameter in um
K=0.5;
sigma=0.072;
T=298.15;
Mw=18.01528;
Pw=0.997;
R=8.3143;
x=(4*sigma*Mw)/((R*T*Pw));
Dd=0.1
for i=0.01:0.1:1
Dd=Dd+i
D=linspace(Dd,2,10);
S=((D.^3-Dd^3)./(D.^3-Dd^3+Dd^3*K)).*exp(x./D)
Scrit=max(S)
Dmax=D(find(S==Scrit))
T=table(Dd, Scrit, Dmax)
filename='Dry diameter.xls';
writetable(T,filename)
end
采纳的回答
更多回答(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!