Distortion at end of signal after low pass filtering

23 ビュー (過去 30 日間)
Impala
Impala 2019 年 12 月 13 日
コメント済み: Impala 2019 年 12 月 16 日
Hi,
I have created a low pass filter with the following properties to smooth out my signal:
function Hd = lpfilt
%LPFILT Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.5 and Signal Processing Toolbox 8.1.
% Generated on: 13-Dec-2019 17:10:56
% Butterworth Lowpass filter designed using FDESIGN.LOWPASS.
% All frequency values are in Hz.
Fs = 10; % Sampling Frequency
Fpass = 0.45; % Passband Frequency
Fstop = 0.55; % Stopband Frequency
Apass = 1; % Passband Ripple (dB)
Astop = 60; % Stopband Attenuation (dB)
match = 'stopband'; % Band to match exactly
% Construct an FDESIGN object and call its BUTTER method.
h = fdesign.lowpass(Fpass, Fstop, Apass, Astop, Fs);
Hd = design(h, 'butter', 'MatchExactly', match);
% [EOF]
I then apply my filter to my signal using the following syntax:
y = filtfilt(SOS,G,x) % SOS and G are filter parameters
This is what the result looks like (see figure below - black - original unfiltered signal; red - filtered signal). The filter is smoothing the signal fine except for the start and end of the signal where it doesn't quite follow the original. Its worse at the end - appears to be distorted i.e. going upwards - is there a way to correct for this?
Thanks!
FilterSignal.jpg

採用された回答

Piyush Dubey
Piyush Dubey 2019 年 12 月 16 日
When filtering a signal the output signal is shifted in time with respect to the input and sometimes the filter delays some frequency components more than others. This link describes on how to compensate for delay and distortion.
  3 件のコメント
Piyush Dubey
Piyush Dubey 2019 年 12 月 16 日
Can you try increasing the order of the filter?
d1 = designfilt('lowpassiir','FilterOrder',12, ...
'HalfPowerFrequency',0.15,'DesignMethod','butter');
y_new = filtfilt(d1,posY);
p1 = plot(y_new);
hold('on');
p2 = plot(posY);
p3 = plot(posY_filt);
legend([p1; p2; p3], ["New filter"; "Actual signal"; "Old Filter"])
I was able to reduce the distortion with the above snippet.
Impala
Impala 2019 年 12 月 16 日
Excellent! It's worked! Many thanks once again. Much appreciated :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFilter Analysis についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by