Hamming Filter in Frequency and Spatial Domain

2019-05-26 07:12发布

问题:

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');

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.)