Please Help me solve this loop!

1 view (last 30 days)
Kevin
Kevin on 10 Dec 2020
Commented: Kevin on 10 Dec 2020
Hello,
I am just student, I want to learn matlab more. But i get some trouble with loop
With t=1 i know how to code, however, Si(t-1) i don't know how to code, can you help me and teach me code for this loop , please ?
  1 Comment
Jan
Jan on 10 Dec 2020
Edited: Jan on 10 Dec 2020
Please post, what you have done so far. Then it is easier to add the needed code.

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 10 Dec 2020
s(i,t) = s(i, t-1) + q(i,t) - d(i,t)

Jan
Jan on 10 Dec 2020
You do not need a loop:
S = cumsum(q - d);

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!