Filter designed by MATLAB during resampling
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I need to understand how the resampling filter is designed and applied in MATLAB's resample function.
Below is my code to generate two signals x1 and x2 (tones at 4kHz and 30kHz) and resample them individually by a factor of 17/15 (for example). The input sampling rate is 64k samples/sec.
%%code start
I = 17;
D = 15;
dataLen = 2000;
%%case 1: sinusoid
% Generate an input signal
f1 = 4000;
fsin = 64 * 1000;
%dataLen = 30;
x1 = cos(2*pi*f1/fsin*(0:dataLen-1));
[y1, h1] = resample(x1, I, D);
%%case 2: random data
% Generate an input signal
f2 = 30000;
%fsin = 64 * 1000;
%dataLen = 30;
x2 = cos(2*pi*f2/fsin*(0:dataLen-1)); %randn(1, dataLen);
[y2, h2] = resample(x2, I, D);
My question is this: The filters returned by MATLAB (h1 and h2) are exactly the same, whereas I had expected them to be different because the signal content is located at different locations wrt the sampling frequency. The only explanation I can think of is that the filter is designed to have a passband spanning fs/2 Hz irrespective of the actual signal. Can someone confirm if that's true.
The filter's frequency response is attached. (plotted by freqz(h1)). It seems to show a passband of around 0.06*pi, which could be considered as (1/17)*pi. Does it mean that in case of resampling by a rational factor of I/D, the filter's passband is always equal to 0.5pi with respect to interpolated sample rate?
Thanks.

0 Commenti
Risposta accettata
Star Strider
il 29 Giu 2016
It’s an antialiasing filter, so yes. I don’t see your freqz call, but if you include the sampling frequency as one of the arguments, you will see that it will scale by the ‘new’ sampling frequency, as it necessarily must.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Multirate Signal Processing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!