I want to separate the signal from the noise with the help of a low pass filter.
26 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
studentmatlaber
el 6 de Mayo de 2021
Comentada: Star Strider
el 30 de Mayo de 2021
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 comentarios
Star Strider
el 6 de Mayo de 2021
I prefer that it be uploaded here. It is easier for me to work with.
Respuesta aceptada
Star Strider
el 8 de Mayo de 2021
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 comentarios
Star Strider
el 30 de Mayo de 2021
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.
Más respuestas (2)
Image Analyst
el 11 de Mayo de 2021
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.
0 comentarios
fyp matlab
el 14 de Mayo de 2021
you can design low pass filter or any kind of filter using:
filterDesigner
command .
0 comentarios
Ver también
Categorías
Más información sobre Digital Filter Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!