0
$\begingroup$

How can I implement a 256-point polyphase FFT whose sidelobe level is 40db down and main lobe width of rectangular window?

If we perform FFT of 256 point with some window, The window will have effect on spectrum and we are going to get spectral leakage which we call as sidelobe as well as the main lobe width increase because of window spectrum get convolved with actual frequency response of the input. With polyphase FFT we can actually control the sidelobe level and mainlobe width both. And we can better frequency resolution with polyphase FFT. So if you have any input on how do we implement polyphase FFT , it would be helpful.

$\endgroup$
5
  • $\begingroup$ Please do not keep asking the same question again and again, especially when the original gets closed. $\endgroup$
    – Peter K.
    Feb 9 at 14:14
  • $\begingroup$ @PeterK.He made an effort to improve the question and you might argue that it was wrongfully closed by someone who does not know about the concept in question and assumed it wasn't meaningful. And might this just be an example of how this community is less than welcoming to newcomers? $\endgroup$
    – Jazzmaniac
    Feb 9 at 18:28
  • $\begingroup$ @Jazzmaniac : Appreciate your comment. $\endgroup$ Feb 10 at 5:27
  • $\begingroup$ @Jazzmaniac Five senior participants, none of whom was me, closed the previous question. It was not a good fit as asked. The OP should have edited that question with the feedback given by others, rather than ask the same question again. I've had the opposite (or different) response from others: this SE site is more welcoming than many others in the network. That does not, however, mean we drop all SE norms on posting duplicates. $\endgroup$
    – Peter K.
    Feb 11 at 16:18
  • $\begingroup$ @PeterK.Still, if you are facing the force of, as you say, five senior participants who were simply wrong about the content of the question, do you think editing it would do? I'm not saying that asking the same question again is the best way forward, but in this case it was a way forward because the alternatives appeared infeasible. And in terms of welcoming culture, other SE sites are hardly a good reference. The problem with this site is that senior participants do not even consider that there's something they don't know. I have faced this frequently and it does not appear to have changed. $\endgroup$
    – Jazzmaniac
    Feb 12 at 13:10

1 Answer 1

4
$\begingroup$

If you only have N points you cannot do better than an N point FFT does. What the polyphase does is to collect more data P * N, apply a window function to the P * N time interval, and then add blocks of size N.

The data processing can be seen as creating an array of size P * N, then viewing it as a matrix of shape P by N and adding all the rows, to get the input of the FFT.

Here an example implementation of this in python

import numpy as np
from numpy.fft import rfft, rfftfreq
import matplotlib.pyplot as plt

# Parameters for the polyphase filter
P = 8 # The data size factor
N = 128 # The fft size

# Two harmonic signals
X1 = np.cos(np.linspace(0, 345, P*N)*np.pi)
X2 = np.cos(np.linspace(0, 346, P*N)*np.pi)

# Standard application of a N-point FFT
plt.figure(facecolor='white', figsize=(12, 4))
plt.subplot(131)
plt.title(f'{N}-point FFT')
plt.semilogy(rfftfreq(N), abs(rfft(X1[:N])))
plt.semilogy(rfftfreq(N), abs(rfft(X2[:N])))
plt.ylim(N*1e-7, N)
plt.grid()

# Apply one FFT to the entire data
plt.subplot(132)
plt.title(f'{P*N}-point FFT')
plt.semilogy(rfftfreq(P*N), abs(rfft(X1[:P*N])/P))
plt.semilogy(rfftfreq(P*N), abs(rfft(X2[:P*N])/P))
plt.ylim(N*1e-7, N)
plt.grid()

# The polyphase FFT
plt.subplot(133)
plt.title(f'Polyphase {P} x {N}-point FFT')
# The window to shape the leakage
W = np.sinc(np.linspace(-P/2, P/2, P*N))
XW1 = np.reshape(X1[:P*N] * W, (P, N)).sum(axis=0)
XW2 = np.reshape(X2[:P*N] * W, (P, N)).sum(axis=0)

plt.semilogy(rfftfreq(N), abs(rfft(XW1)))
plt.semilogy(rfftfreq(N), abs(rfft(XW2)))
plt.ylim(N*1e-7, N)
plt.grid()

Different filter responses

Reference: https://casper.astro.berkeley.edu/wiki/The_Polyphase_Filter_Bank_Technique

Edit #1

If you want to use the same amount of data the polyphase filter reduces to windowing. In this case you will have a tradeoff between the amount of leaking away from the center frequency and the leaking close the center frequency. You make a peak more prominent by making it less sharp.

Beware that numpy sinc function is defined as $\sin(\pi x) / (\pi x)$

import numpy as np
from numpy.fft import rfft, rfftfreq
import matplotlib.pyplot as plt

# Parameters for the polyphase filter
N = 128 # The fft size
S = 1

# Two harmonic signals
X1 = np.cos(np.linspace(0, 345, N)*np.pi)
X2 = np.cos(np.linspace(0, 346, N)*np.pi)

W = np.sinc(np.linspace(-1, 1, N))

# Standard application of a N-point FFT
plt.figure(facecolor='white', figsize=(12, 4))
plt.subplot(131)
plt.title(f'{N}-point FFT')
plt.semilogy(rfftfreq(N), abs(rfft(X1[:N])))
plt.semilogy(rfftfreq(N), abs(rfft(X2[:N])))
plt.ylim(N*1e-7, N)
plt.grid()

# Apply one FFT to the entire data
plt.subplot(131)
plt.title(f'{P*N}-point FFT')
plt.semilogy(rfftfreq(N), abs(rfft(X1[:N])))
plt.semilogy(rfftfreq(N), abs(rfft(X2[:N])))
plt.ylim(N*1e-7, N)
plt.grid(True)

# The polyphase FFT
plt.subplot(132)
plt.title(f'Sinc window')
# The window to shape the leakage
plt.semilogy(rfftfreq(N), abs(rfft(X1[:N] * W)))
plt.semilogy(rfftfreq(N), abs(rfft(X2[:N] * W)))
plt.ylim(N*1e-7, N)
plt.grid(True)


# The polyphase FFT
plt.subplot(133)
plt.title(f'Sinc squared window')
# The window to shape the leakage
plt.semilogy(rfftfreq(N), abs(rfft(X1[:N] * W**2)))
plt.semilogy(rfftfreq(N), abs(rfft(X2[:N] * W**2)))
plt.ylim(N*1e-7, N)
plt.grid(True)

windowing

In the paper describe a different window in section 4. A bit confusing but what I understood is that hey introduce another factor $\textrm{sinc}(\omega_c n / \pi) \cdot \omega_c / \pi$.

$\endgroup$
10
  • $\begingroup$ Thanks for details. I agree with you that we need to collect to extra data length like you mentioned. But here is a link to paper which uses the polyphase approach with N point FFT itself without collecting more data. So i was confused if we can ahead with Polyphase when we have N point FFT. Let me know what you feel about this paper researchgate.net/publication/… $\endgroup$ Feb 10 at 5:23
  • $\begingroup$ Thanks Bob on analyzing the paper i mentioned. You had mentioned that polyphase becomes windowing if we use the same amount of data and gave python example for the same. But the in the paper i had mentioned , below are the steps that are followed. Below are the steps followed in paper. $\endgroup$ Feb 13 at 3:52
  • $\begingroup$ I think missed adding the steps mentioned in the paper.Here are the rough steps mentioned in this paper in Section 5 1. Consider signal of length N 2. Remove the DC by finding avaerage 3. Reverse the Input signal 4. Obatin filters impulse response of length N for a proto type low pass filter 4. Convolve the impulse response 5. Perform the N point IDFT to get the final spectrum. I did implement this in matlab , it seems to give the same results as that of paper. So wondering if this is correct way of implementing polyphase with just N point $\endgroup$ Feb 15 at 4:29
  • $\begingroup$ Sorry, the steps are implicit. 1. I defined X1 and X2, 2. The signal has zero mean, so there is no need to remove DC, 3 I omitted this step but again what is the point of flipping a sine wave. About the steps 4 and 5 I don't think is what you are supposed to do. The idea of the polyphase filter is to have a low complexity, so why would you use a convolution? $\endgroup$
    – Bob
    Feb 15 at 8:47
  • $\begingroup$ thanks for replying. I did some more study on this polyphase technique and referred few more papers. I see in the below paper , they have mentioned that polyphase FFT can be done even when length of the data is less than the filter coeffieicnts. So datalength has been decoupled with filter coefficients. ieeexplore.ieee.org/document/10051908 $\endgroup$ Feb 23 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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