How to remove noise from the noisy signal
27 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jan
2019-7-19
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.
回答(1 个)
Vinai Datta Thatiparthi
2019-7-29
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!