如何从 Lanczos 过滤器获取频率 Window

How to Get Frequency Window from Lanczos Filter

我有 Lanczos 过滤器的代码:

dT = 1 % sampling interval
Cf = 1/40 % cutoff frequency
fl = 100 % ?
M = 100 % number of coefficients ? not sure about number
LoH = 1 % low pass

Nf=1/(2*dT); %Nyquist frequency

% Normalize the cut off frequency with the Nyquist frequency:
Cf = Cf/Nf;

% Lanczos cosine coeficients:
coef = lanczos_filter_coef(Cf,M); coef = coef(:,LoH);

% Filter in frequency space:
[window,Ff] = spectral_window(coef,length(vel)); Ff = Ff*Nf;

% Filtering:
[y,Cx] = spectral_filtering(vel,window);

function coef = lanczos_filter_coef(Cf,M)
% Positive coeficients of Lanczos [low high]-pass.
hkcs = lowpass_cosine_filter_coef(Cf,M);
sigma = [1 sin(pi*(1:M)/M)./(pi*(1:M)/M)];
hkB = hkcs.*sigma;
hkA = -hkB; hkA(1) = hkA(1)+1;
coef = [hkB(:) hkA(:)];
end

function coef = lowpass_cosine_filter_coef(Cf,M)
% Positive coeficients of cosine filter low-pass.
coef = Cf*[1 sin(pi*(1:M)*Cf)./(pi*(1:M)*Cf)];
end

function [window,Ff] = spectral_window(coef,N)
% Window of cosine filter in frequency space.
Ff = 0:2/N:1; window = zeros(length(Ff),1);
for i = 1:length(Ff)
    window(i) = coef(1) + 2.*sum(coef(2:end).*cos((1:length(coef)-1)'*pi*Ff(i)));
end
end

function [y,Cx] = spectral_filtering(vel,window)
% Filtering in frequency space is multiplication, (convolution in time 
% space).
Nx  = length(vel);
Cx  = fft(vel(:)); Cx = Cx(1:floor(Nx/2)+1);
CxH = Cx.*window(:);
CxH(length(CxH)+1:Nx) = conj(CxH(Nx-length(CxH)+1:-1:2)); 
y = real(ifft(CxH));
end

我需要从中绘制时间 window 和频率 window 的图表。我得到了来自 coef 的时间 window,但我不知道哪个输出会给我频率 window。我绘制了输出变量的所有可能组合,并尝试对其中一些进行傅里叶变换,但我尝试的任何操作都没有给我预期的数字。

频率 window 在输出“window”中,因此需要绘制 (Ff,window)。你会得到一个图表,在 Cf 附近有一个强烈的下降(所以 1/50),这是你选择的截止频率,它将你将用于低通滤波器的频率与用于高通滤波器的频率分开。