How to change values in previous made loop?
Afficher commentaires plus anciens
Hi everyone,
I am trying to model a centrifuge with higher concentrations. My problem is that the formed pellet in a centrifuge can only have a certain volumetric fraction (cmax). I made a loop where the volumetric fraction is calculated. At the end of the centrifuge it will give values higher than cmax. Now, I want to give the excess back to the previous cell when cmax is reached. For this, I made a small loop, which calculates backwards from the end of the centrifuge to the beginning:
for i = Nr:-1:2 % Force system to give back excess to previous cells
c(i) = c(i)+excess;
if c(i)>cmax
excess = c(i)-cmax;
c(i) = cmax;
c(i-1) = c(i-1)+excess;
else
excess = 0;
end
end
However, my code seems to ignore this loop. Without this loop, I get the same values as without it and I am puzzled why.
I also added the files I work with.
Thank you very much in advance!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!