0
$\begingroup$

I want to know what is the proper way of downsampling a sampled signal using Fourier transform.

In scipy.signal.resample the code it first converts the signal to frequency domain, then discards the middle half of the frequencies (i.e. second and third quarters), then inverse-transform back to time domain. Therefore it is trying to keep the lowest and highest frequencies of the signal.

Due to Nyquist-Shannon we know that we cannot reconstruct a frequency of $f$ without at least $2f+1$ samples of the signal. Then when downsampling, shouldn't we discard the second half of the frequencies instead?

I already read related answers in dsp.stackexchange but couldn't find a good explanation, so I decided to try math.stackexchange.

https://dsp.stackexchange.com/questions/52941/scipy-resample-fourier-method-explanation

https://dsp.stackexchange.com/questions/45446/pythons-tt-resample-vs-tt-resample-poly-vs-tt-decimate

$\endgroup$
2
  • $\begingroup$ If you want us to comment on a source file with $3521$ lines, it would make sense to provide the line number you're referring to. $\endgroup$
    – joriki
    Commented Dec 14, 2019 at 11:59
  • $\begingroup$ @joriki sorry, I have edited to include link to code $\endgroup$
    – Michael
    Commented Dec 14, 2019 at 13:03

1 Answer 1

1
$\begingroup$

The answer is in the first post you linked to:

To downsample, it transforms to the frequency domain and deletes the second and third groups of $N/4$ elements (which correspond to the half with the highest frequency components).

So apparently you confused the middle half of the elements as stored in memory with the middle half of the frequencies.

$\endgroup$
1
  • $\begingroup$ I should have read more carefully $\endgroup$
    – Michael
    Commented Dec 14, 2019 at 21:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .