# 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?

• no, for a regular ZOH, there should be no zeros inserted. only hold $x[n]$ constant until $x[n+1]$ comes along. – robert bristow-johnson May 17 at 20:04
• Yes, right, I was wrong. There shouldn't be any zeros inserted. That's the convolution of the signal x[n] with the rect impulse response that forms the reconstructed signal at the output. – dirac16 May 17 at 20:13

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!

• Seems cool. But what if I want to apply an FOH interpolation what ir should be then? – dirac16 May 17 at 19:58
• by "FOH", do you mean linear interpolation, right? – robert bristow-johnson May 17 at 20:05
• Yeah, actually. I think the triangular impulse response can do it, but not sure how to modify ir – dirac16 May 17 at 20:09