Problem with standard methods of smoothening in Signals

1 view (last 30 days)
I'm encountering a challenge in MATLAB related to signal processing using the Signal Processing Toolbox. I have a noisy signal that I need to filter to extract meaningful information. The signal contains both high-frequency noise and low-frequency drift. My goal is to design a filter that effectively removes the noise while preserving the underlying signal characteristics. I've attempted to use standard filtering techniques, but I'm not satisfied with the results due to either over-smoothing or residual noise. Can someone provide guidance on how to design an optimal filter for this scenario, considering both the high-frequency noise and low-frequency drift present in the signal?

Accepted Answer

Hari
Hari on 12 Feb 2024
Edited: Hari on 2 Apr 2024
Hi Satya,
I understand that you have a noisy signal containing both high-frequency noise and low-frequency drift, and you want to design an optimal filter to effectively remove the noise while preserving the underlying signal characteristics.
Assumption: The noisy signal is sampled at a sufficient frequency to capture both high-frequency noise and low-frequency drift.
To address this issue, you can utilize a combination of high-pass and low-pass filtering techniques to target the removal of both high-frequency noise and low-frequency drift while preserving the desired signal content.
One approach is to use a cascaded filter design, where a high-pass filter is applied first to remove the low-frequency drift, followed by a low-pass filter to attenuate the high-frequency noise. Additionally, adaptive filtering techniques such as the Kalman filter can be effective in separating the signal from noise, especially when the characteristics of the noise are known or can be estimated.
Below is an example demonstrating a cascaded filter design using a high-pass and low-pass filter:
% Generate noisy signal (example)
fs = 1000; % Sampling frequency
t = 0:1/fs:5; % Time vector
signal = sin(2*pi*10*t) + 0.5*sin(2*pi*50*t) + 2*randn(size(t)); % Noisy signal
% Design high-pass filter to remove low-frequency drift
highpass_cutoff = 0.5; % Cutoff frequency for high-pass filter (adjust as needed)
hp_filter = designfilt('highpassfir', 'FilterOrder', 50, 'CutoffFrequency', highpass_cutoff, 'SampleRate', fs);
% Design low-pass filter to attenuate high-frequency noise
lowpass_cutoff = 30; % Cutoff frequency for low-pass filter (adjust as needed)
lp_filter = designfilt('lowpassfir', 'FilterOrder', 50, 'CutoffFrequency', lowpass_cutoff, 'SampleRate', fs);
% Apply high-pass filter
filtered_signal = filtfilt(hp_filter, signal);
% Apply low-pass filter
filtered_signal = filtfilt(lp_filter, filtered_signal);
% Plot original and filtered signals
figure;
plot(t, signal, 'b', 'LineWidth', 1.5); hold on;
plot(t, filtered_signal, 'r', 'LineWidth', 1.5);
xlabel('Time (s)');
ylabel('Amplitude');
legend('Original Signal', 'Filtered Signal');
title('Cascaded High-pass and Low-pass Filtering');
grid on;
Output observed:
Please Note: The following output is generated for the sample data simulated. Please use your actual data and do adjustments to the filter parameters so that it fits to your use case.
Refer to the documentation of the following functions to know more about the usage:
Hope this helps!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!