MATLAB: How to stack STEM plots in a single Matlab plot

stem stack

I am trying to stack 3 STEM plots but unable to do so.
I did the 3 normal plots by doing +1 and +2.
How can I do it?

Best Answer

x = (1:10)';
y = rand(10,3);
ys = cumsum(y,2);
stem(x,fliplr(ys))