clear;close all;clc
%1.数字滤波器的技术指标
ap = 1;%通带最大衰减
as = 30;%阻带最小衰减
fp = 208;%通带截止频率
fs = 488;%阻带截止频率
Fs = 1888;%抽样间隔
T = 1/Fs;
%2.将数字指标转化成模拟滤波器技术指标《来用冲激响应不变法wap = 2*pi*fp!was = 2*pi*fs;
%3.设计滤波器
[N,wac] = buttord(wap,was,ap,as,s');%计算阶数N和3dB截止频率wac[z,p,k] = buttap(N);%创建巴特沃斯低通滤波器 z零点p极点k增益[Bap,Aap] = zp2tf(z,p,k);%由零极点和增益确定归一化Han(s)系数[Bbs,Abs] = 1p21p(Bap,Aap,wac);%将s/wc 代替s,去归一化[B,A] = impinvar(Bbs,Abs,Fs);%模拟域到数字域一冲激响应不变法[H1,w] = fregz(B,A);%根据H(z)求频率响应
figure(1);f = w*Fs/(2*pi);
subplot(2,1,1);plot(f,28*1oglg(abs(H1)));%绘制幅度响应title("冲激响应不变法一巴特沃斯BLPF(幅度));
xlabel("频率/Hz');ylabel("H1幅值/dB");subplot(2,1,2);
plot(f,unwrap(angle(H1)));% 绘制相位响应xlabel('频率/Hz');ylabel("角度/Rad');title("冲激响应不变法一巴特沃斯BLPF(相位));
%1.数字滤波器的技术指标
ap = 1;%通带最大衰减
as = 30;%阻带最小衰减
fp = 208;%通带截止频率
fs = 488;%阻带截止频率
Fs = 1888;%抽样间隔
T = 1/Fs;
%2.将数字指标转化成模拟滤波器技术指标《来用冲激响应不变法wap = 2*pi*fp!was = 2*pi*fs;
%3.设计滤波器
[N,wac] = buttord(wap,was,ap,as,s');%计算阶数N和3dB截止频率wac[z,p,k] = buttap(N);%创建巴特沃斯低通滤波器 z零点p极点k增益[Bap,Aap] = zp2tf(z,p,k);%由零极点和增益确定归一化Han(s)系数[Bbs,Abs] = 1p21p(Bap,Aap,wac);%将s/wc 代替s,去归一化[B,A] = impinvar(Bbs,Abs,Fs);%模拟域到数字域一冲激响应不变法[H1,w] = fregz(B,A);%根据H(z)求频率响应
figure(1);f = w*Fs/(2*pi);
subplot(2,1,1);plot(f,28*1oglg(abs(H1)));%绘制幅度响应title("冲激响应不变法一巴特沃斯BLPF(幅度));
xlabel("频率/Hz');ylabel("H1幅值/dB");subplot(2,1,2);
plot(f,unwrap(angle(H1)));% 绘制相位响应xlabel('频率/Hz');ylabel("角度/Rad');title("冲激响应不变法一巴特沃斯BLPF(相位));