How to extend a vector continuously in a loop
Show older comments
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..
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!