2
$\begingroup$

I have a signal sampled at 40MHz, I would like to resample it to 37MHz. The signal is not periodic, I did resampling with Matalb resample function and it doesn't cause phase shift (as far as I understood). Matlab applies an anti-aliasing FIR filter and compensate for the delay introduced by the process.

I want to do the same process in Python. I know there is a resample function in scipy.signal but the documentation is not clear for me. Does the resample function introduces phase shifts?

if so, there is also a decimate function in scipy as well which applies similar FIR filter. Should I use decimate function over resample?

$\endgroup$
2
$\begingroup$

Unfortunately, although scipy.signal.decimate has a zero phase shift argument, the decimation factor can only be an integer so you won't be able to downsample from 40KHz to 37kHz.

scipy.signal.resample, on the other hand, can do the resampling you want but may (and most likely will) introduce phase shifts in your signal.

There are other options, ( e.g sklearn.resample), so have a look at them as well.

$\endgroup$
2
$\begingroup$

Upsample first by 12 and then downsample by 13, you'll get very close to 37Mhz, 36.92MHz to be precise, should be good enough.

If you want exactly 37Mhz, then upsample by 37 and then downsample by 40, but this is more calculation intensive with not much gain, so better opt for the first strategy. Also antialsiaing demands are less for the first case.

$\endgroup$

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.