Why is the filtered signal mirroring the raw one ?

조회 수: 4 (최근 30일)
RaAy
RaAy 2023년 11월 18일
답변: Mathieu NOE 2023년 11월 20일
I am trying to filter EMG signal.. I have applied high-pass, then low-pass, then notch filter for powerline interferences.
My filtered signal looks like it mirrors the raw signal.. there are random peaks in the filtered signal that are a mirror of the raw one
How can I solve this?
Here is my filter function:
cutoff_freq_highpass = 30; % Cutoff frequency for high-pass filter in Hz
highpass_order = 5; % High-pass filter order
% Design the high-pass filter
[b_highpass, a_highpass] = butter(highpass_order, cutoff_freq_highpass/(fs/2), 'high');
% Apply the high-pass filter
HP = filter(b_highpass, a_highpass, y);
% Define the low-pass filter parameters for noise removal
cutoff_freq_lowpass = 450; % Cutoff frequency for low-pass filter in Hz
lowpass_order = 4; % Low-pass filter order
% Design the low-pass filter
[b_lowpass, a_lowpass] = butter(lowpass_order, cutoff_freq_lowpass/(fs/2) , 'low');
% Apply the low-pass filter
LP = filter(b_lowpass, a_lowpass, HP);
% Define the notch filter parameters
powerline_freq = 50; % Powerline frequency in Hz
notch_order = 4; % Notch filter order
% Design the notch filter
[b_notch, a_notch] = butter(notch_order, [(powerline_freq-1)/(fs/2), (powerline_freq+1)/(fs/2)], 'stop');
% Apply the notch filter to remove powerline interference
NCH = filter(b_notch, a_notch, LP);
% Apply the low-pass filter to remove noise
e = filter(b_notch, a_notch, NCH);

답변 (1개)

Mathieu NOE
Mathieu NOE 2023년 11월 20일
hello
I think what you interpret as "mirrored" peaks is just pure luck, for the good reason that there are no scientific reasons why filtering a signal (except doing a simple polarity inversion) could creat the exact mirrored version of the raw signal
but still depending of what filters are used ,you could have a phase shift of + or - 180° in a given frequency range, so if that matches your signal frequency, yes , the output would look mirrored ,
but in that case also your filter has no amplitude impact (gain = 1) so it's not really a filter
beside all that bla bla , I would recommend you use filtfilt instead of filter to have zero phase distorsion , but notice that filtfilt will apply your filtering twice (forward and backward in time) , so either reduce the filter order and change the cut off frequency to keep things equal

카테고리

Help CenterFile Exchange에서 Frequency Transformations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by