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..
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!