I have written some code below in MATLAB to filter a Noisy signal (noise_f
is the noisy signal, where it is a 1
x 256
vector):
s_nf = size(noise_f);
size_f = s_nf(2);
lp_tresh = ceil((2/3)*size_f);
lp_f = zeros(1,256);
for n = 1:lp_tresh
lp_f(n) = noise_f(n);
end
subplot(4,3,7);
plot(abs(lp_f)); title('LowPass Filter Result');
Here is a time domain image of the noisy signal:
Here is a time domain analysis of this signal:
Once I plot the result of the lowpass filter, I get this:
Now I apply the ifft
on the 1
x 256
vector that represents the filtered signal and for some reason, I get this image :
Can someone explain to me how to get the proper plot of the filtered signal? All help and suggestions will be appreciated!
To get a strictly real result, the input to an IFFT must be complex conjugate symmetric. Chopping off the part of the FFT above bin N/2 (or below bin 0) destroys that symmetry if any of those bins are non-zero.
Thus, a low-pass filter will only work in the frequency domain if it's cutoff is below bin N/2 (representing Fs/2). Then make sure the filtered result is conjugate symmetric before doing the IFFT.