How to extend a vector continuously in a loop
显示 更早的评论
I have to construct a vector for my initial conditions to solve my ode system. Im modelling CSTR in series, and for each reactor i need initial conditions for 10 differential equations, which is defined as
ini_vector=[par.nN2_in par.nH2_in 0 0 0.01 0 0 0 0 0.999];
Initially i have only modeled 8 CSTR in series, so i have defined my vector of initial conditions as:
initial=[ini_vector ini_vector ini_vector ini_vector ini_vector ini_vector ini_vector ini_vector];
Is there a more simple way to make this vector initial?
I have tried to set up a loop to make the vector for 1000 CSTR
ini=[];
for k=1:N_CSTR
ini_vector=[par.nN2_in par.nH2_in 0 0 0.01 0 0 0 0 0.999];
initial = [ini ini_vector];
end
but my code is not working.. I've searched for simular examples but have not found any that seem to enlighten me on how to make this work. I would be grateful if someone could suggest a way to make this work..
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!