Why Do digitalFilter Object Functions Ignore the Filter's SampleRate Property?

46 visualizaciones (últimos 30 días)
Paul
Paul el 21 de Dic. de 2024 a las 23:44
Respondida: Ashok el 31 de Dic. de 2024 a las 5:16
Design a low pass filter
lpFilt = designfilt('lowpassiir','FilterOrder',8, ...
'PassbandFrequency',35e3,'PassbandRipple',0.2, ...
'SampleRate',200e3);
Plot its frequency response using the digitalFilter object function freqz
figure
freqz(lpFilt,4096)
I'm surprised that the default behavior is to plot against normalized frequency, rather than using the SampleRate parameter of the object to plot against ordinary frequency.
lpFilt.SampleRate
ans = 200000
Maybe the idea is to be consistent with how the function freqz() behaves for inputs that are not digitalFilter objects. But then I'm really surprised that the object function allows the user to specify a different sample rate than that for which the filter is designed
figure
freqz(lpFilt,4096,lpFilt.SampleRate*3);
Similarly the object function impz allows one to specify a different sample rate
figure
impz(lpFilt,100,lpFilt.SampleRate/2)
Any idea why the object functions of a digitalFilter seem to completely ignore its SampleRate property?

Respuestas (1)

Ashok
Ashok el 31 de Dic. de 2024 a las 5:16
Hi John,
The ability to specify sample rates in the freqz or impz functions, can be useful for visualizing how the response would appear if the filter were designed for another sample rate and same normalized frequency. Further, this approach ensures that user is aware of the sample rate context when interpreting the frequency response.
As an alternative, fvtool can be used for filter visualization. It provides plots of frequency, step, impulse response, and more, while considering the sample rate specified during filter design. Here's an example:
Fs = 1000; % Sample rate in Hz
Fc = 100; % Cutoff frequency in Hz
dFilt = designfilt('lowpassiir','FilterOrder',4,'HalfPowerFrequency',Fc,'SampleRate',Fs,'DesignMethod','butter');
fvtool(dFilt)
For more information kindly refer the following documentation page:

Productos


Versión

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by