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!