Signal amplitude decreases after FIR filter(windowing method)

11 views (last 30 days)
I am applying a low pass filter with the windowing method to my signal in order to truncate it in the frequency domain. The bandwidth of the filter should be 3GHz. I guess that works fine. The filter, however, seems to attenuate the amplitude of the signal. What do I need to do to get the same amplitude as the original signal after filtering?
I am using filters for the first time. I do appreciate any help or explanation.
sig = MY SIGNAL;
fs = 4000; % sampling freq. (GHz)
M = 400001; % signal length
% Filter parameters:
L = M; % filter length
fcut = 1.5; % cutoff frequency (GHz)
% Design the filter using the window method:
hsupp = (-(L-1)/2:(L-1)/2);
hideal = (2*fcut/fs)*sinc(2*fcut*hsupp/fs);
h = hamming(L)' .* hideal; % h is our filter
SIG_out = fft(sig); % signal
H = fft(h); % filter
FILT_OUT = SIG_out .* H;
filt_out = ifft(FILT_OUT);
relrmserr = norm(imag(filt_out))/norm(filt_out) % check... should be zero

Answers (1)

Star Strider
Star Strider on 10 Mar 2022
I have no idea what the sampling frequency is, so I assume 10 GHz here, with a cutoff of 1.5 GHz. When I simulate it with the freqz function, it shows essentially no attenuation in the passband (as it should not), a stopband frequency of 1.5 GHz (as designed) and an appropriate transition region. Some parameters are not given (specifically ‘M’ and ‘fs’) so the filter behaviour here may be different from what your analysis shows. However on the basis of the freqz results, the problems you are seeing with it may simply be that your analysis — and not the filter design — is incorrect. (A larger value for ‘M’ will give a sharper cutoff and shorter transition region.)
M = 64; % Create 'M'
fs = 1E+10; % Create 'fs'
L = M; % filter length
fcut = 1.5E+9; % cutoff frequency (GHz)
% Design the filter using the window method:
hsupp = (-(L-1)/2:(L-1)/2);
hideal = (2*fcut/fs)*sinc(2*fcut*hsupp/fs);
h = hamming(L)' .* hideal; % h is our filter
figure
freqz(h, 1, 2^16, fs)
.
  25 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!