0
$\begingroup$

I'm having a rough time doing the following question from a HW. Given a sequence of your choice, what happens to the DFT if we add a 0 between every sample? I.e. if we have x[n] = [A,B,C], we turn it into x[n] = [A,0,B,0,C,0].

My initial thought was that the sampling frequency would double, similar to when we zero pad at the end of the signal. To do some analysis, I used the following MATLAB code.

Fs = 300;            % Sampling frequency                    
T = 1/Fs;             % Sampling period       
L = 1500;             % Length of signal
t = (0:L-1)*T;        % Time vector

S = 0.7*sin(2*pi*50*t); %Signal - sine 50 Hz
z = zeros(1,3000);
z(1:2:end) = S; %Zero interp
z_fft = fft(z);
z_abs = abs(z_fft/(L*2));

P = z_abs(1:L*2/2+1);

P(2:end-1) = 2*P(2:end-1);
f = Fs*(0:(L*2/2))/(L*2);
plot(f,P);

Which yields the following plot: enter image description here

That is different from the result when I add the same number of 0's but to the end of the sequence: enter image description here

So I got confused, what is the result of adding the 0 between every sample? Does that doubles the frequency of my signal? What about that peak on f = 125Hz? Or am I making something wrong on my simulation?

Thanks for your time!

$\endgroup$
  • $\begingroup$ try using a test signal that isn’t periodic $\endgroup$ – Stanley Pawlukiewicz Jun 14 at 15:21
  • $\begingroup$ I tried using exp(-0.2*t).*sin(50*t) and it produced a similar outcome $\endgroup$ – Raphael Ruschel Jun 14 at 22:11
0
$\begingroup$

You can use expansion analysis to deduce what happens when a sequence is zero staffed in between its samples.

Let $x[n]$ be your original length $N$ sequence. Then its expansion by $2$ yields the new sequence $y[n]$ of length $2N$ :

$$ y[n] = \begin{cases} { x[n/2] ~~~,~~~n = 2m \\ ~~~~~ 0 ~~~,~~~ \text{otherwise} } \end{cases} $$

Then the DTFT relation between $Y(e^{j\omega})$ and $X(e^{j \omega})$ will be : $$Y(e^{j\omega}) = X(e^{j 2 \omega})$$

Then the DFT relation between N-point $X[k]$ and 2N-point $Y[k]$ will be

$$Y[k] = Y(e^{j \frac{2\pi}{2N} k}) = X(e^{ j 2 \frac{2\pi}{2N} k}) = X[k] ~~~,~~~ k = 0,1,...,2N-1$$

In other words, $Y[k]$ will be two copies of $X[k]$

$\endgroup$
  • $\begingroup$ I believe that I understood the math you used and the given result but I'm still struggling to interpret the graphical results achieved before. Does the sampling at every 2m for x[n/2] yield a change of sampling rate? Because the result looks like a "squished" version of the two copies of X[k] $\endgroup$ – Raphael Ruschel Jun 15 at 20:34
  • $\begingroup$ @RaphaelRuschel for your understanding I would explain it like this: when you insert a zero between existing samples, then you are effectively pushing the samples apart by two, hence the period of the sine wave will double and its frequency will be halved. You can interpret this as a doubling of sampling rate to 600 Hz, but you have neither implemented it properly, nor should assume such necessarily. All you can conclude is the mathematical relation as I have provided and their consequences on the DFT / FFT frequency samples. $\endgroup$ – Fat32 Jun 15 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.