Hello Gray,
I am not sure what exactly you want but I guess following control logic is similar to what you want.. It is the counter logic which gives the staircase signal as shown below..
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174488/image.jpeg)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!