How to change values in previous made loop?
이전 댓글 표시
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!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!