Question
Hi, How could I remove the noise from a mat file? The fs is 30 Hz. I tried to use a low pass filter, but seem not work well. I am not good at programming matlab. Could you fix my code and explain that? clear all; load('examples.mat'); n = 57; y = examples(n).data; figure(1) grid on; plot(y); xlabel('Times'); ylabel('Amplitude'); title('Original Noisy Signal'); fs = 30; fpass = 3; yf = lowpass(y, fpass, fs); figure(2) grid on; plot(yf); xlabel('Times'); ylabel('Amplitude'); title('Filtered Signal');
Expert Answer
Prashant Kumar
PhD Expert
Answered Sep 15, 2026
The problem is that your signal displays broadband noise (readily apparent in the Fourier transform plot), and no freuqency-selective filter is going to have any effect on it. The best you can do is to use wavelets, or the smoothdata function (introduced in R2017a), however your signal resisted my attempts to reduce the noise in the fft using 'sgolay' or any other method.
I post my code in the event you want to experiment with the smoothdata function:
D = load('examples.mat');
data = D.ppg.data;
Fs = 30; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
L = numel(data);
t = linspace(0, L, L)/Fs;
figure
plot(t, data)
grid
title('PPG Signal')
xlabel('Time (s)')
ylabel('Amplitude (?)')
datam = mean(data);
FTdata = fft(data - datam)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
plot(Fv, abs(FTdata(Iv))*2)
grid
title('Fourier Transform - Original Signal')
xlabel('Frequency (Hz)')
ylabel('Amplitude (?)')
xlim([0 7])
datafilt = smoothdata(data, 'rlowess', 15);
datam = mean(datafilt);
FTdatafilt = fft(datafilt - datam)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
plot(Fv, abs(FTdatafilt(Iv))*2)
grid
title('Fourier Transform - Filtered Signal')
xlabel('Frequency (Hz)')
ylabel('Amplitude (?)')
xlim([0 7])
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →