Not sure how to perform ZOH upsampling Sorry if the question looks pretty naive. My goal is to up-sample a given signal x[n] by a factor of M using the zero order hold interpolation function. 



The basic idea of up-sampling is to add M-1 zeros after each sample. So that makes sense. That forms MN new samples, where N is the length of the sampled signal x[n]. Now if I want to apply ZOH should I go and hold each sample value for one sample interval? Say if M=2 the above discrete signal would have become like this after applying ZOH:



Is my understanding correct?
You are correct. There is a trick you can use to code this process very easily. Assuming Matlab syntax, define a rectangular impulse response with M ones:

ir = ones(1,M);


Then, filter the upsampled train of impulses x:

zoh = conv(x,ir);


and you're done!