在过滤器设计中使用Matlab的sinc()?

时间:2018-03-20 11:31:47

标签: matlab filter signal-processing

为了设计一个过滤器(窗口方法),我首先生成我的sinc函数,如下所示:

L = 20;
fc = 0.25;
n = (1:L)';
my_sinc = sin(2*pi*fc*(n-L/2)) ./ (pi*(n-L/2));            
my_sinc(L/2) = 2*fc;

然后我申请窗口:

win = blackman(L, 'symmetric');
filter_coeffs = (my_sinc .* win);

可以使用Matlab的内置sinc()函数完成第一步吗?

1 个答案:

答案 0 :(得分:3)

绝对。您可以使用内置sinc函数获得与my_sinc中计算的结果完全相同的结果。从sinc(x) = sin(pi*x)/(pi*x)开始,在你的情况下,sin函数的输入参数x等于2*pi*fc*(n-L/2)。然后可以将分母写为xpi*(n-L/2) = 0.5*x/fc)的函数,它为2*fc乘以sinc的缩放因子。这可以在这里说明:

builtin_sinc = 2*fc*sinc(2*fc*(n-L/2));
hold off; stem(n, my_sinc);
hold on;  plot(n, builtin_sinc, 'rx');

enter image description here

然后,您可以随后使用

获得相同的滤波器系数
filter_coeffs = (builtin_sinc .* win);

或直接

filter_coeffs = 0.5*sinc(2*fc*(n-L/2)) .* win;