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 についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!