这个FIR线性相位数字微分器怎么用matlab设计?
如何利用海明窗设计N=24(23阶)的FIR线性相位数字微分器(用matlab实现),并求出h(n)(传递函数),并画出幅频特性和相频特性。
好难啊,怎么做教一下,请给出matlab代码和图,谢谢啦
这个FIR线性相位数字微分器怎么用matlab设计?
如何利用海明窗设计N=24(23阶)的FIR线性相位数字微分器(用matlab实现),并求出h(n)(传递函数),并画出幅频特性和相频特性。
好难啊,怎么做教一下,请给出matlab代码和图,谢谢啦
clc,clear,close all;
%hamming窗
M=23;alpha=(M-1)/2;n=0:M-1;
hd=(cos(pi*(n-alpha)))./(n-alpha);hd(alpha+1)=0;
w_ham=(hamming(M))'; h=hd.*w_ham; [Hr,w,P,L]=Hr_Type3(h);
%plots
subplot(221);stem(n,hd);
title('Ideal Impulse Response')
axis([-1 M -1.2 1.2]);
xlabel('n');ylabel('hd(n)')
subplot(222);stem(n,w_ham);
title('Hamming Window')
axis([-1 M 0 1.2]);xlabel('n');ylabel('w(n)')
subplot(223);stem(n,h);
title('Actual Impulse Response')
axis([-1 M -1.2 1.2]);xlabel('n');ylabel('h(n)')
subplot(224);plot(w/pi,Hr/pi);
title('Amplitude Response');grid;
axis([0 1 0 1]);xlabel('frenquency in pi units');ylabel('slope in pi units');
%子函数:
function [Hr,w,c,L] = Hr_Type3(h);
% Computes Amplitude response of Type-3 LP FIR filter
% - - - - - - - - - - - - - - - - ---
% [Hr,w,c,L] = Hr_Type3(h)
% Hr = Amplitude Response
% w = frequencies between [0 pi] over which Hr is computed
% c = Type-3 LP filter coefficients
% L = Order of Hr
% h = Type-3 LP impulse response
%
M = length(h);
L = (M-1)/2;
c = [2*h(L+1:-1:1)];
n=[0:1:L];
w = [0:1:500]'*pi/500;
Hr = sin(w*n)*c';
end