《DSP using MATLAB》示例Example7.7

时间:2023-03-10 01:06:01
《DSP using MATLAB》示例Example7.7

Type-4 Linear-Phase FIR filter

《DSP using MATLAB》示例Example7.7

代码:

h = [-4, 1, -1, -2, 5, 6, -6, -5, 2, 1, -1, 4];
M = length(h); n = 0:M-1;
[Hr, w, d, L] = Hr_Type4(h);
d
L dmax = max(d) + 1; dmin = min(d) - 1; figure('NumberTitle', 'off', 'Name', 'Exameple 7.7')
set(gcf,'Color','white'); subplot(2,2,1); stem(n, h); axis([-1, 2*L+1, dmin, dmax]); grid on;
xlabel('n'); ylabel('h(n)'); title('Impulse Response'); subplot(2,2,3); stem(1:L, d); axis([-1, 2*L+1, dmin, dmax]); grid on;
xlabel('n'); ylabel('d(n)'); title('d(n) coefficients'); subplot(2,2,2); plot(w/pi, Hr); grid on;
xlabel('frequency in \pi units'); ylabel('Hr'); title('Type-4 Amplitude Response'); subplot(2,2,4); zplane(h); grid on;
xlabel('real axis'); ylabel('imaginary axis'); title('Pole-Zero Plot');

  运行结果:

《DSP using MATLAB》示例Example7.7

《DSP using MATLAB》示例Example7.7

3个零点对,一个零点位于ω=0处。