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

 채택된 답변

VBBV
VBBV 2023년 3월 27일

0 개 추천

ini_vector=[par.nN2_in par.nH2_in 0 0 0.01 0 0 0 0 0.999];
Initial = repmat(ini_vector,1,8)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

2023년 3월 27일

댓글:

2023년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by