Fs = 1000; % Sampling frequency
T = 1/Fs; % Sample time
L = 1000; % Length of signal
t = (0:L-1)*T; % Time vector
% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid
x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
y = x + 2*randn(size(t)); % Sinusoids plus noise
ydft = fft(y);
ydft(abs(ydft)<200)=0;
yfilt = ifft(ydft);
plot(yfilt(1:100),'b','linewidth',2)
hold on;
plot(y(1:100),'k');
legend('Filtered Signal','Unfiltered Signal');
I will probably get some ringing, but hopefully not that much. If so, then go back to evaluating the filter for a large set of data??? My filter is ~4096, but the dataset can be pretty large! You can't just multiply the frequency responses!
Also, I'm not sure whether to use a hanning window when I create