# Upsampling by zero padding or duplicating sequence

I need to upsample a 2 MHz signal by a factor of 3000 to convert the OQPSK modulated baseband signal to passband. When I upsample by duplicating the elements in the sequence, I seem to get less error compared to padding the sequence with zeros. The frequency spectrum is also better when I duplicate elements whereas with zero padding, the spectrum shows nothing. I am now confused on which way is the right method to upsample a sequence and why.

• It sounds like you're trying to upsample the baseband signal to a rate commensurate with the final RF that you want to transmit it on. This is not how it's done in practice. You generate the signal at baseband, then use hardware to upconvert it to the desired carrier frequency. Generating a several-gigasample-per-second signal so that you can shift its frequency digitally is not practical. – Jason R May 20 '15 at 14:19
• Before using hardware to upconvert to the desired frequency, I would like to simulate the same in Matlab and compare this result with the result produced when using hardware. – smyslov May 20 '15 at 14:29

:Boggle:
Neither is correct. You should interpolate between samples if you need to convert to a higher sampling rate.
Linear interpolation is easiest, but will cause harmonics to appear in the output.

Linear interpolation with a lowpass filter is better. Use the nyquist frequency for your original signal (before upsampling) as the cutoff for the lowpass.

There are other methods that you can find fairly easily now that you know what you need to look for.

I don't know enough about what you are doing to be certain, but I'm pretty sure that upsampling to that extent shouldn't be neccessary unless you are doing something special - like working backwards from a result to compare to some original signal.

• The purpose for upsampling/oversampling in my case is that I need to perform a passband modulation with a carrier at 2.4 GHz and the baseband signal is sampled at 2 MHz. In order to apply a carrier to the baseband signal so that the peak is now centered at 2.4 GHz, I first need to upsample the Baseband signal to a higher rate and I am doing this in matlab by using the 'Upsample' function which pads zeros. Is this not the right way of doing this? – smyslov May 20 '15 at 13:53
• Not, not the right way. See this link for more info: divilabs.com/2014/07/upsampling-interpolation-of-discrete.html – JRE May 20 '15 at 14:00
• In the reverse case, for downsampling, I am using the downsample function from Matlab after low pass filtering the signal. Should I be doing something else? I am a noob to signal processing and please excuse me for asking such simple questions. – smyslov May 20 '15 at 14:25
• Downsampling that way works fine. – JRE May 20 '15 at 14:27

Matlab’s ‘upsample()’ command does not “pad” a sequence with zero-valued samples. The ‘upsample()’ command “stuffs” a sequence with zero-valued samples. “Zero padding” and “zero stuffing” are two different operations. “Zero padding” means appending a sequential string (a sequence) of zero-valued samples to the beginning or end of a sequence.

I believe what you want to do is: ‘Upsample()” your time-domain sequence to the desired final sample rate that's compatible with your 2.4 GHz carrier sequence. Next, lowpass filter the upsampled sequence. Then multiply the filtered sequence by your high-frequency carrier sequence.