Digital Filter not Applying designed frequency response as expected

19 visualizaciones (últimos 30 días)
midiosh
midiosh el 18 de Abr. de 2020
Editada: Mehmed Saad el 18 de Abr. de 2020
I'm trying to apply a simple IIR Low Pass filter to clean up a set of data. I've designed the filter using MATLAB's designFilt function:
fs=25; %25 Hz
lpFilt = designfilt('lowpassiir','FilterOrder',32, ...
'PassbandFrequency',2,'PassbandRipple',0.2, ...
'SampleRate',fs);
fvtool(lpFilt)
output = filter(lpFilt, output);
%% Plot Spectrum
% Setup for Signal Processing Toolbox Spectrum Analyzer
S = seconds((0:numSamples-1)'/fs);
input_tTable = timetable(S, input);
output_tTable = timetable(S, output);
fvtool shows the following frequency response for the filter:
The filter is relatively flat on the pass band and clearly has a strong cutoff at 2Hz.
The input signal (shown below on the left) signal has a clear low frequency fundamental I'm trying to extract, and judging by sine waveform analysis (see markers below) has a frequency of approximately 0.25Hz. After applying the low pass filter (cutoff 2Hz), I would expect to see a clearer ~0.25Hz tone.
After using the filter to process the signal, the result is shown below (Left is input, right is output)
**I used the Signal Processing Toolbox Signal Analyzer to produce the figure
The resulting output signal (right) is quite different from what I expected. Firstly, in the time domain, the signal has a massive transient response with a large time delay. Also on the pass band, the frequency spectrum is somewhat different (Note how the input has a dip at 2Hz whereaws the output has a peak)
Can anyone explain to me why this is happening? Am I doing something wrong with my designing/using of the filter?
I appreciate any feedback

Respuestas (1)

Mehmed Saad
Mehmed Saad el 18 de Abr. de 2020
Editada: Mehmed Saad el 18 de Abr. de 2020
Transient Response
fs=25; %25 Hz
lpFilt = designfilt('lowpassiir','FilterOrder',32, ...
'PassbandFrequency',2,'PassbandRipple',0.2, ...
'SampleRate',fs);
fvtool(lpFilt)
%%
t = 0:1/fs:10-1/fs;
s = sin(2*pi*10*t)+ sin(2*pi*1*t);
output = filter(lpFilt, s);
figure,plot(t,output)
When ever a filter is implemented, it needs some data to fill its taps let's say we call it transient response
As your filter order is high so you are getting high transient response in the start approx for 2 seconds
Greater the filter order, higher the transient response
Let's change the filter order to 16
fs=25; %25 Hz
lpFilt = designfilt('lowpassiir','FilterOrder',16, ...
'PassbandFrequency',2,'PassbandRipple',0.2, ...
'SampleRate',fs);
fvtool(lpFilt)
%%
t = 0:1/fs:10-1/fs;
s = sin(2*pi*10*t)+ sin(2*pi*1*t);
output = filter(lpFilt, s);
figure,plot(t,output)
You can see that transient response is lesser than the previous one
At 2Hz
As your filter pass pand ends at 2Hz it will still appears as an attenuated peak like (30-40dB)atttenuated

Categorías

Más información sobre Digital and Analog Filters en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by