%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 巴特沃夫滤波器 wp=2*pi*2500;ws=2*pi*3500;Rp=1;As=30; [N,wc]=buttord(wp,ws,Rp,As,'s')%计算率波器的阶数和3dB截止频率 [B,A]=butter(N,wc,'s');%计算滤波器系统函数分子分母多项式 fk=0:800/512:8000; wk=2*pi*f... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
巴特沃夫滤波器
wp=2*pi*2500;ws=2*pi*3500;Rp=1;As=30;
[N,wc]=buttord(wp,ws,Rp,As,'s')%计算率波器的阶数和3dB截止频率
[B,A]=butter(N,wc,'s');%计算滤波器系统函数分子分母多项式
fk=0:800/512:8000;
wk=2*pi*fk;
Hk=freqs(B,A,wk);
figure
plot(fk/1000,20*log10(abs(Hk)));
grid on,xlabel('频率(kHz)'),ylabel('幅度(dB)')
title('低通滤波器')
axis([0,4,-35,5])
%%%%%%%%%%%%%%%%%%%%%
信号为m=[ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)].*cos(2*pi*fc.*t).*cos(2*pi*fc.*t);
cos(2*pi*fc.*t)相干载波
1、设计一个滤波器,并画图查看性能
2、生成信号,注意采样率
3、进行卷积
例子如下:
t = 0:0.01:2;
f =2*sin(2*pi*20*t)+4*sin(2*pi*60*t);
N = 11; %滤波器节点个数
wc = 0.3; %归一化截止频率
hd = fir1(N,wc,'low'); % 基于加窗函数的FIR滤波器设计
figure(3)
plot(hd)
ft = conv(f,hd);
figure(1)
plot(abs(fft(f)));
title('原始信号f');
figure(2)
plot(abs(fft(ft)));
title('滤波后信号ft');