Why is the filtered signal mirroring the raw one ?
1 次查看(过去 30 天)
显示 更早的评论
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1543072/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1543077/image.png)
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);
0 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Filter Banks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!