# Up-sampling using ZOH

The basic idea of up-sampling is to add $$M-1$$ zeros after each sample. I need to make upsampling(factor of 3) of the function $$rcosdesign(\beta, M, T)$$ using the ZOH filter in Matlab. $$\beta=0.25$$, $$M=6$$, $$T=4$$.

I didn't get a full understanding of the upsampling using this filter, so i need help on how this should be done.

ZOH and rcosdesign are two different things. What you mean may be is to generate a time domain filter of rcosdesign(0.25,6,4) and then use ZOH on it.

h=rcosdesign(0.25, 6, 4);


will generate the rcosdesign impulse function that you want. Then you need to upsample by 3 by interleaving 2 zeros in between each sample.

h_upsby3 = upsample(h,3);


Zero order hold is like a rectangular function in time domain. Here, for every sample of h_upsby3, there would be 3 ones to simulate a zero-order hold as per your specification.

r=ones(1,3);
y=conv(h_upsby3,r);


to generate a plot like this below

Upsampling is basically padding zeros in between signal samples and then interpolation. The interpolation itself is a low pass filter. The rcosdesign is a low pass filter so after zero padding by factor of 3, you need to convolve the resulting zero padded sequence with this filter.

Note that: it is not an ideal filter, so you would get varied attenuation for different frequencies for the discrete time frequency repsonse after convolving with this filter.

Further, remember you would be "drawing in" frequency components from other periodic repetitions of the discrete time frequency response of the original sequence immediately after zero padding, these would appear in the high frequencies of your $$-\pi$$ to $$\pi$$ spectrum hence roll off and spectrum of original sequence would decide the amount of alisaing and distortion of the original signal's frequency response.

As an example if your original sequence is bandlimited in $$-\pi/4$$ to $$\pi/4$$. Then this would shrink to $$-\pi/12$$ to $$\pi/12$$ after upsampling by 3 but you would also get frequency components to the left of $$-7\pi/12$$ and right of $$7\pi/12$$. So in this example make sure your roll of begins at $$-\pi/12$$ and $$\pi/12$$ and frequency resonse of filter decays very much to 0 before $$7\pi/12$$ and $$-7\pi/12$$

Sample MATLAB code below:

Sampling period implied and ignore the time scale:

close all;
clear all;
clc;

t=-5:0.1:5;
T=5;
RECT=rectpuls(t,T);
FFT_size=1024;

signal_fft=fft(RECT,FFT_size);

signal_up=upsample(RECT,3);
signalup_fft=fft(signalup,FFT_size);
h=rcosdesign(0.25,64,2);
H=fft(h,FFT_size);
Product=H.*signalup_fft;
filtered_sequence=ifft(Product,FFT_size);

figure;
subplot(6,1,1);
plot(t,RECT);
ylim([-2 2]);
xlim([-5 5]);
title('original signal');
subplot(6,1,2);
plot(fftshift(abs(signal_fft)));
title('frequency response of original signal,periodicity implied');
subplot(6,1,2);
plot(fftshift(abs(signal_fft)));
title('frequency response of original signal,periodicity implied');
subplot(6,1,3);
plot(fftshift(abs(signalup_fft)));
title('frequency response of upsampled signal,periodicity implied');

subplot(6,1,4);
plot(fftshift(abs(H)));
title('frequency response of rcosdesign filter,periodicity implied');

subplot(6,1,5);
plot(fftshift(abs(Product)));
title('frequency response of filtered sequence,periodicity implied');

subplot(6,1,5);
plot(filtered sequence);
title('recovered signal, ignore time scale');


• thanks for the help, any chance you can explain to me how to do this on Matlab? – lasri23 Apr 12 '20 at 10:24
• @Iasri23 sure, give me sometime, I will paste all the plots and MATLAB code for the entire process – Dsp guy sam Apr 12 '20 at 12:19
• @Iasri23 attached the MATLAB code and plots to illustrate the concept I discussed in the answer, hope it helps – Dsp guy sam Apr 12 '20 at 13:24