数字信号处理课程设计代码,大报告详见https://blog.csdn.net/weixin_42845306/article/details/117033419
上传之后才发现缺失一部分代码,不好意思,这就补上
function [Bz,Az]=lvboqi()
fs=100;%采样频率
T=1/fs;%采样间隔
wpz=0.35*pi;%数字通带截止频率
wsz=0.45*pi;%数字阻带截止频率
wp=2/T*tan(wpz/2);%模拟通带截止频率,预畸变
ws=2/T*tan(wsz/2);%模拟阻带截止频率,预畸变
rp=1;%通带衰减(dB)
rs=40;%阻带衰减(dB)
lambda=ws/wp;
k=sqrt((10^(rs/10)-1)/(10^(rp/10)-1));
N_caculate=log10(k)/log10(lambda);
[N,wc]=buttord(wp,ws,rp,rs,'s');%根据指标计算阶数和截止频率
[B,A]=butter(N,wc,'s');%得出模拟滤波器系数
figure
freqs(B,A)
[Bz,Az]=bilinear(B,A,fs);%利用双线性变化法转换成数字滤波器
figure
freqz(Bz,Az);
[H,w]=freqz(Bz,Az);%得出函数值
subplot(211)
hold on
plot([0.35,0.35],[0,-300],':g','linewidth',1.5)
plot([0.45,0.45],[0,-300],':r','linewidth',1.5)
subplot(212)
hold on
plot([0.35,0.35],[0,-1500],':g','linewidth',1.5)
plot([0.45,0.45],[0,-1500],':r','linewidth',1.5)
20*log10(abs(H(180)))%35Hz频率处衰减
20*log10(abs(H(232)))%45Hz频率处衰减
20*log10(abs(H(257)))%50Hz频率处衰减
20*log10(abs(H(512)))%100Hz频率处衰减
end
1