I want to separate the signal from the noise with the help of a low pass filter.

조회 수: 37 (최근 30일)
Hello to everyone. I had many signals in the time domain. I first converted these signals to the frequency domain with fft. I am sharing the image of the signal in the frequency domain with you. What I need to do now is to separate the noise from the signal by passing this noisy signal through a low pass filter. but I don't know how to do it as I've never done it before. I would be very happy if you could help with this. They said I can use the firpm command for the filter.
%the code I used to convert to frequency domain
Tt = Time{i,m};
x = signal{i,m};
L = length(Tt);
Ts = mean(diff(Tt));
Fs = 1/Ts;
Fn = Fs/2;
X = fftshift(fft(x)/L);
Fv2 = linspace(-Fn, Fn, L);
  댓글 수: 6
Star Strider
Star Strider 2021년 5월 6일
I prefer that it be uploaded here. It is easier for me to work with.
studentmatlaber
studentmatlaber 2021년 5월 7일
@Star Strider Actually I have 24 .mat files, but I can throw 1 of them from here.

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2021년 5월 8일
I could not figure out which of those signals you want to filter, so I arbitrarily chose ‘t1’ and ‘y1’.
They are not consistently sampled, so I used the resample function to correct that. This will eliminate the high-frequency noise, however I was not able to eliminate the baseline offset using a bandpass filter, since I do not know what constitutes the signal and what constitutes the baseline drift. I leave that to you to experiment with, using:
[yfilt,df] = bandpass(xr, [0.005 0.04], Fs, 'ImpulseResponse','iir');
Experiment with the lower passband frequency to get the result you want.
Try this —
LD = load('Data4.mat');
t = LD.t1;
y = LD.y1;
Tt = t;
x = y;
[xr,Ttr] = resample(x,Tt,4.5);
L = numel(Ttr);
Ts = mean(diff(Ttr));
Tsd = std(diff(Ttr));
Fs = 1/Ts;
Fn = Fs/2;
X = fftshift(fft(xr-mean(xr))/L);
Fv2 = linspace(-Fn, Fn, L);
figure;
plot(Fv2, abs(X));
grid;
xlabel('Frequency');
ylabel('Amplitude');
xlim([-0.25 0.25])
[yfilt,df] = lowpass(xr, 0.04, Fs, 'ImpulseResponse','iir');
figure
subplot(2,1,1)
plot(Ttr, xr, '-b')
grid
title('Original Signal')
subplot(2,1,2)
plot(Ttr, yfilt, '-r')
grid
title('Filtered Signal')
I cannot run this in the online application since I cannot load .mat files in it.
  댓글 수: 7
studentmatlaber
studentmatlaber 2021년 5월 30일
@Star Strider Hello again, sorry for asking questions all the time. There was no phase difference when I used the filtfilt command. however, this command does not work with any value other than [0.04 0.5]. When you use these values, too much noise remains in the signal. I want to narrow this range. Do you have an idea?
[n, fo, ao, w] = firpmord ([0.04 0.5], [1 0], [0.001 0.001], Fs{i,m});
Star Strider
Star Strider 2021년 5월 30일
That vector defines the frequencies, and they are not allowed to be less than or equal to 0 or greater than ‘Fs/2’. Check Fs and make appropriate changes depending on that value.
That is the only possibility I can think of.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Image Analyst
Image Analyst 2021년 5월 11일
What is i and m?
What I'd do it do just zero out the middle of the FFT signal to "zero out" high frequencies. Or zero out the beginning and end of the fft if you shifted it with fftshift() so that the zero frequency point is in the middle. Then inverse transform with ifft(). It's kind of old school and primitive and you have to know what range you want to zero out over (you can experiment). It's probably not as sohpisticated as what Star Strider recommended (certain special MATLAB functions), but this "manual" way might be fine for you.

fyp matlab
fyp matlab 2021년 5월 14일
you can design low pass filter or any kind of filter using:
filterDesigner
command .

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by