how save the calculated values from the loop one after the other in a vector ?
6 ビュー (過去 30 日間)
古いコメントを表示
This loop should calculate the dwell time and the sum function for me. For example, a time from zero to 46 is determined by the loop. How can I save these numbers in a vector / matrix with one column and several rows? Unfortunately, I am not very fit in matlab. I would be happy if someone could help.
The dwell time should be calculated using the Euler method
clear all
clc
V = input('Please enter the volume of the stirred tank in m³: ');
Vs = input('Please enter the volume flow in l / s: ');
c_zu = input('Please enter the initial concentration in mol / l: ');
h = input('Please enter the time step h in min: ');
c_zu = c_zu*1000;
Vs= Vs*0.06; % volume flow in m³/min
t= 0; %time in min
c= 0; %Start concentration in mol/m³
k = 0;
tau= V/Vs; % tau= volum /Volum flow
Abbr = 10^(-3.6);
F = 0;
c_Ab = 0;
for i = 1:1000
t= t+ h;
dcdt=1/tau*(c_zu- c_Ab);
c = c+ dcdt * h;
F = c_Ab/c_zu;
k = k+1;
if c_zu-c_Ab <= Abbr
break
else
c_Ab = c;
end
Vektor_c_Ab(i:1) = c_Ab;
Vektor_t(i:1) = t;
Vektor_F(i:1) = F;
end
Vektor_c_Ab
Vektor_t
Vektor_F
k
g = plot(Vektor_F,Vektor_t); grid on;
0 件のコメント
採用された回答
VBBV
2021 年 11 月 4 日
Vektor_c_Ab(i) = c_Ab;
Vektor_t(i) = t;
Vektor_F(i) = F;
Use the loop iterator index variable
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!