How to remove noise from the noisy signal
25 views (last 30 days)
Show older comments
Hi, I am new to the MATLAB community. I have to remove noise from a signal. I followed a previous post and changed my signal to frequency. However, I don't know how to use ifft and filters properly. My excel spreadsheet is attached here. Any help will be grately appreciated. Thank you.
function [ output_args ] = Fourier4( )
[D, S] = xlsread('file2.xlsx');
t = D(:,1);
EKG = D(:,2);
figure
plot(t, EKG)
L = numel(t);
tr = linspace(min(t), max(t), L);
EKGr = resample(EKG, tr);
Ts = mean(diff(t));
Fs = 1/Ts;
Fn = Fs/2;
MeanV = mean(EKGr);
FT_EKG = fft(EKGr-MeanV)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(tr, EKGr)
FT_EKGA = abs(FT_EKG(Iv));
figure
plot(Fv,FT_EKGA)
xlabel('Frequency (Hz)')
ylabel('Amplitude (mV)')
Y = ifft(FT_EKGA);
figure
Plot (tr, abs (Y))
end
1 Comment
Jan
on 19 Jul 2019
Before you can filter the noise, you have to define, what the noise is. Maybe you are interested in the low frequency signal, or in the high frequencies. We cannot guess, what "properly" means in your case.
Answers (1)
Vinai Datta Thatiparthi
on 29 Jul 2019
Hi Rupa!
To begin with, I’d prefer using the command readtable instead of xlsread, since the former is the recommended command now. You can split the data accordingly using –
data = readtable('file2.xlsx');
t = table2array(data(:,1));
EKG = table2array(data(:,2));
Further, after you convert the signal into frequency domain using fft, MATLAB provides a wide range of functions as part of the Signal Processing Toolbox that can help you remove the noise. One of the easier functions to start with could be fir1 which allows you to design filters based on the different parameter details that you provide. You may use the function filter to apply the filter you created to the signal of your choice. Refer to this link for the necessary documentation –
As an addition, consider using the Filter Designer App in MATLAB. The documentation is at –
This detailed article contains multiple examples of filtering signals –
0 Comments
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!