# Discrete-time system question

I have the below discrete-time system:

$$k_{i+1}= max (0, 2-k_i)$$ With $$k(0)=4$$

The state of the system keep switching between $-2$ and $0$ or i made something wrong?

-
The maximum of $0$ and $-2$ is not going to be $-2$. –  Gerry Myerson Feb 3 '13 at 23:22
if you replace -2 by 2 then yes. I don't mean to be unpleasant, but this is really so straightforward that I can't think OP has really put some thought into this before asking. –  Glougloubarbaki Feb 3 '13 at 23:28
I don't understand it. If $k(0)=4$ isn't suppose to calculate $2-k(0)= -2$ ? –  xkrpz Feb 3 '13 at 23:35
no, since -2<0, you have max(0,-2)=0=k_1. Then k_2 = max(0, 2-0)=2. Then k_3 = max(0, 2 - 2)=0, etc, so it oscillates between 0 and 2 –  Glougloubarbaki Feb 3 '13 at 23:43
Good. Now that you get it, you can post what you have figured out as an answer. Then, later, you can accept it. –  Gerry Myerson Feb 5 '13 at 3:58
show 1 more comment