Hamming Filter in Frequency and Spatial Domain

1k Views Asked by At

I want to remove the Gibbs artifact in a 1D signal by applying the Hamming filter on that in MATLAB.

What I have is the k1 which is the signal in frequency domain. I can get the signal in time domain by applying DFT on k1:

s1 = ifft(ifftshift(k1));

This signal has Gibbs artifact. Now, I want to remove it by (A) multiplying Hamming filter to k1 in teh frequency domain and (B) convolving IFFT of Hamming filter with s1 in the spatial domain. I am expecting same output from both of these:

% (A) Multiplying Hamming filter to `k1`
n = size(k1,2);
wk = hamming(n,'symmetric')'; 
k2 = wk.*k1;
s2 = ifft(ifftshift(k2));

% (B) Convolving IFFT of Hamming filter with `s1`
wx = ifft(ifftshift(wk));
s3 = conv(s1,wx,'same');

enter image description here

The result of (A), s2, seems to be correct since the signal looks blurred and the Gibbs artifact is gone. However, the result of (B), s3, is completely different and incorrect. What is missing in (B)? (Please download k1.mat from this link if you need it.)

1

There are 1 best solutions below

0
On

From the data you posted what you call "Gibbs" on space are high frequency components on frequency. When you multiply your hamming window in frequency in fact you are smoothing those higher frequencies. They are in the borders (negative and positive) of your complex array k1.

Bellow is what happens when you make k2 = wk.*k1;

enter image description here

That's why your so called space "Gibbs" is gone.

This is not a stander use of a Hamming window that is commonly applied on time|space to reduce Gibb's on frequency when clipping and sampling a signal, function or filter kernel on time|space.

To reproduce it in space you would have to design a very smooth low pass filter that gives the hamming window response in frequency to make that convolution. I don't recall the inverse transform of a Hamming Window but you could use a gaussian filter.

Btw wx = ifft(ifftshift(wk)); gives a wx not symmetric with respect to its maximum.