Update a variable for each step along x-axis within loop

Hi there
So I'm calculating an erosion rate along a profile. For the first step, x = 1, I use an initial concentration of 0.1. My system then erodes sediment at the first step. I want to add this sediment to the initial concentration and use this updated concentration for x = 2, and so on.
For example
maxX = 100
C = 0.1
x = 1
while x < maxX
E = C * 50
C = C + E
x = x+1
end
So for x(1) :
E = 0.1*50
E = 5
Then for x(2), I want to carry out the code using the re-calculated C value, so C(2) = C(1) + Y(1) = 5.1
and then continue doing the code within the loop, recalculating C each time, all the way up to maxX.
Does anyone know how to write this?
Thank you!

답변 (0개)

카테고리

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

제품

질문:

2021년 3월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by