# What would be the effect of repeating samples in time domain on frequency domain?

Consider the operation of up-sampling a signal n times by repeating each sample n times in the time domain. What would the frequency domain response of the resultant signal be like given the frequency response of the original signal?

• this is just a discrete-time interpolation with zero-order hold kernel. Nov 28 '18 at 11:36

It's quite beneficial to view the mathematical expression of the process as well.

A mere $$N$$ times repetition of a single sample (pixel) into the new enlarged block is an interpolation with zero-order hold kernel. This is mostly applied for fast but crude image zooming.

In 1D, the kernel is $$h_0[n] = \begin{cases}{ 1 ~~~,~~~ 0 \leq n \leq N-1 \\ 0 ~~~,~~~ \text{ otherwise } } \end{cases} \tag{1}$$

The interpolated signal can be expressed as :

$$y[n] = \sum_{k} x[k] h_0[n-kN] \tag{2}$$ this can be expressed as a convolution like

$$y[n] = \left(\sum_{k} x[k] \delta[n- Nk] \right) \star h_0[n] \tag{3}$$

where the signal in parenthesis is the expanded version of $$x[n]$$:

$$x[n] \rightarrow \boxed{ \uparrow N} \rightarrow x_e[n] = \sum_{k} x[k] \delta[n- Nk] \tag{4}$$

Applying DT Fourier transform on Eq(3) yields:

$$Y(e^{j\omega}) = X_e(e^{j\omega}) \cdot H_0(e^{j\omega}) \tag{5}$$

where $$X_e(e^{j\omega}) = X(e^{j\omega N})$$ due to the expansion operation in Eq(4) and $$H_0(e^{j\omega})$$ is the DTFT of the rectangular pulse $$h_0[n]$$ which is:

$$H_0(w) = e^{-j\omega (N-1)/2} \frac{ \sin( \omega N /2 ) } { \sin( \omega / 2 ) }$$

then the result becomes:

$$Y(e^{j\omega}) = X(e^{j\omega N}) \cdot e^{-j\omega (N-1)/2} \frac{ \sin( \omega N /2 ) } {\sin( \omega / 2 ) } \tag{6}$$

Whose magnitude is : $$\boxed{ |Y(e^{j\omega})| = |X(e^{j\omega N})| \cdot \left| \frac{ \sin( \omega N /2 ) } {\sin( \omega / 2 ) } \right| } \tag{7}$$

Note that the $$X(e^{j \omega N})$$ is composed of repeated images of $$X(e^{j \omega})$$. And the effect of the interpolation kernel $$h_0[n]$$ is to remove the images as much as possible with that crude frequency response $$H_0(e^{j \omega})$$.

The following Octave/Matlab code demonstrates the operation:

N = 8;    % interpolation factor
L = 32;   % original input signal length
x = 5*( sin(0.3*pi*([0:L-1]-L/2))./(pi*([0:L-1]-L/2))).^2;
x(isnan(x))=5*0.3*0.3;   % original input

h0 = ones(1,N);    % zero-order hold impulse response

xe = zeros(N*L,1);  % expanded signal
xe(1:N:N*L) =  x;

yi = conv(xe, h0);  % interpolated signal: y[n] = xe[n] * h0[n]

figure,subplot(2,1,1);
stem(x);
title('original signal');
subplot(2,1,2);
stem(yi);
title('zero-order hold interpolated output');

figure,subplot(2,1,1);
plot(linspace(0,2,1024),abs(fft(x,1024)),'b');
title('Spectrum magnitude of x[n]')

subplot(2,1,2);
plot(linspace(0,2,1024),abs(fft(xe,1024)),'b');
hold on
plot(linspace(0,2,1024),abs(fft(h0,1024)),'r');
plot(linspace(0,2,1024),abs(fft(yi,1024)),'g','linewidth',2);
legend('|X_e(w)|','|H_0(w)|','|Y_i(w)|');


with the following outputs:

and the spectrum:

as you can see, nulls of the periodic sinc (the Dirichlet kernel) are at the centers of the repeated spectra (the images) of $$X(w)$$. However, this is not enough to suppress them all, unlike an ideal lowpass filter (or one of its adequate approximations) which would practically eliminate the image spectra, and yield only the one inside the main lobe; yielding an almost perfect interpolation compared to this crude zero-order hold kernel giving.

• Wow, great answer! This is better than the other answer that it helped me realize how the Dirichlet kernel suppresses the repeated images and provides for a neater frequency response. Thanks Nov 28 '18 at 13:13
• @KevinSelvaPrasanna your welcome ! Nov 28 '18 at 13:16
• Note that this upsampling method (repeating samples) does not conserve spectrum very well. Zero-padding the added samples however gives a periodization of the spectrum, so that the original information can still be extracted with a low-pass filter Nov 28 '18 at 13:17

There are two ways (I see right now) to model this system in terms of other known systems. First that comes to my mind is a zero-order sample and hold system. Although those are usually described in a continuous time domain, it might be interesting to look at as well.

Another model is a combinition of a usual upsampler followed by an FIR with all $$N$$ taps set to $$1$$, where $$N$$ is equal to the upsampling factor.

So first you get the usual narrowed down and repeated Frequency spectrum the upsample block produces and then you multiply it with the FIRs frequency response. As the filter is a rectangle with height $$1$$ and width $$N$$ in the time domain, its frequency spectrum is a phase-shifted Dirichlet kernel.

• That's a good answer, it's just that in discrete time the transform of a (discrete) rectangle is not a sinc function but a Dirichlet kernel. Nov 28 '18 at 10:29
• Wow! thanks. I really like the second model. Nov 28 '18 at 11:19