# Smoothing in frequency domain and impulse reponse of the filter in time-domain

I have a low-pass signal in frequency domain, $$\left[f_{min}=0, f_{max}=20\,\mathrm{GHz}\right]_{n=100}$$

After re-configuring the input signal as $$X=\left[-f_{max},\ \dots\ -f_{min},\ \mathrm{DC},\ f_{min},\ \dots\ f_{max} \right]_{2n+1}$$

and constructing a Hamming window of length $$2n+1$$ as win = hamming(2n+1),

# Now the question is, how to perform smoothing and eventually get the impulse response of the filter?

Another confusing point is whether I should convolve the input signal with the window function?

-or-

Is it the multiplication between the input signal and the window function? Like X.*win?

In this context do I need perform fft(hamming(length(2n+1))) on window function?

time            = 5; % in nano-seconds
z0              = 50;
A               = importdata("sparameters_lowpass.dat");
M               = 2048;

freq            = A(:,1);
freq_neg        = -1.0*flip(freq);

realPart        = A(:,2);
imagPart        = A(:,3);

s11_freq        = realPart + imagPart*i;
s11_conj        = conj(flip(s11_freq));

F               = [freq_neg(1:end-1)', freq(1),     freq(2:end)'];
X               = [s11_conj(1:end-1)', s11_freq(1), s11_freq(2:end)'];

win             = (hamming(length(X)));

freq_multip     = X.*win';

s11_time        = ifft(freq_multip);

z_in            = z0 * (1 + s11_time)./(1 - s11_time); % input impedance


Any help to the correct approach is very helpful.

• First of all, though you may know this, convolution in time domain is equivalent to multiplication in frequency domain, and vice versa. So, if you want to use a smoothing window in the frequency domain you would have to use multiplication. That being said, the window function that you are using probably creates a signal in the time domain (check that), so you either have convert it to frequency domain, or convert your signal in the frequency domain to time domain (and perform the convolution). – DaDSPGuy Mar 9 '20 at 13:04
• Can you elaborate on what exactly you want to achieve by smoothing? You want to remove sudden transition for edge frequencies? – jithin Mar 11 '20 at 14:12
• @jithin Problem is very simple. I have S-parameters of a low-pass filter and need to get the impulse response by taking inverse Fourier transform. – jomegaA Mar 11 '20 at 20:46

You get the time domain values of hamming window from the hamming function. Multiplying it with the frequency domain data will not give the correct result. Smoothing is usually performed by multiplying in time domain. You could try multiplying the fourier transform of hamming window with the Frequency domain signal. and then performing the inverse fft.

I modified the code to do Hamming window filtering (window input signal with time domain of window). Since I do not have your dat file, I assumed random values. X_t is the time domain signal corresponding to X. This needs to be windowed with hamming window. (convolution in frequency domain)

time            = 5; % in nano-seconds
z0              = 50;
%A               = importdata("sparameters_lowpass.dat");
A               = zeros(100,3);
A(:,1) = 0:200e6:20e9-200e6;
A(:,2:3) = rand(100,2);
M               = 2048;

freq            = A(:,1);
freq_neg        = -1.0*flip(freq);

realPart        = A(:,2);
imagPart        = A(:,3);

s11_freq        = realPart + imagPart*1i;
s11_conj        = conj(flip(s11_freq));

F               = [freq_neg(1:end-1)', freq(1),     freq(2:end)'];
X               = [s11_conj(1:end-1)', s11_freq(1), s11_freq(2:end)'];
X_t             = fftshift(ifft(X));

win             = hamming(length(X));
X_t_wind        = X_t.*win';
X_t_wind_ft     = fft(X_t_wind);

figure()
plot(F,abs(X),'b',F,abs(X_t_wind_ft),'r')
s11_time        = ifft(freq_multip);

z_in            = z0 * (1 + s11_time)./(1 - s11_time); % input impedance