I have a signal with many frequencies. how to remove particular frequencies from it

13 views (last 30 days)
hey guys,
I need to filter some particular frequencies from my signal, I have a signal which I know that has freq between 50 Hz to over 2450 Hz. now I just want to delete freq bigger than 2450 Hz from my signal. here is my code:
fs = 10000; % Sampling rate [Hz]
Ts = 1/fs; % Sampling period [s]
fNy = fs / 2; % Nyquist frequency [Hz]
duration = 10; % Duration [s]
t = 0 : Ts : duration-Ts; % Time vector
noSamples = length(t); % Number of samples
f = 0 : fs/noSamples : fs - fs/noSamples; % Frequency vector
vp1 = vp(:,:,1)+vp(:,:,2)+vp(:,:,3)+vp(:,:,4)+...
vp(:,:,5)+vp(:,:,6)+vp(:,:,7)+vp(:,:,8)+...
vp(:,:,9)+vp(:,:,10)+vp(:,:,11)+vp(:,:,12)+...
vp(:,:,13)+vp(:,:,14)+vp(:,:,15)+vp(:,:,16)+...
vp(:,:,17)+vp(:,:,18)+vp(:,:,19)+vp(:,:,20)+...
vp(:,:,21)+vp(:,:,22)+vp(:,:,23)+vp(:,:,24);
x_fft = abs(fft(vp1));
hold on
%Plot
figure(1);
subplot(2,1,1);
plot(t,vp1);
subplot(2,1,2);
plot(f,x_fft);
xlim([0 fNy]);
and here is the result :
fig.png

Answers (2)

Marco Dellantonio
Marco Dellantonio on 26 Sep 2019
You want to delete frequency above a certain thresold. You can simply check the index which corresponds to the thresold frequency and replace the magnitude of the Fourier Transform with 0 for every element of the modulus (a simple cicle is needed).

Star Strider
Star Strider on 27 Sep 2019
Use the lowpass function (R2018a and later).

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!