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..

 Respuesta aceptada

VBBV
VBBV el 27 de Mzo. de 2023
ini_vector=[par.nN2_in par.nH2_in 0 0 0.01 0 0 0 0 0.999];
Initial = repmat(ini_vector,1,8)

Más respuestas (0)

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 27 de Mzo. de 2023

Comentada:

el 27 de Mzo. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by