⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daitong.m

📁 数字信号处理 各种滤波器的设计
💻 M
字号:
%带通(haxes1,haxes2)
%function []=daitong(haxes1,haxes2)

haxes1=axes('position',[0.20,0.10,0.65,0.40]);
haxes2=axes('position',[0.20,0.55,0.65,0.40]);

fp=1,fs=2,ap=1;
fc=fp*(10^(0.1*ap)-1)^(-0.1);
[B1,A1]=butter(5,fc,'s');
[hf1,f1]=freqs(B1,A1,1024);
i=1;
while f1(i)<1
    h1(i)=hf1(i);
    fg1(i)=f1(i);
    i=i+1;
end
j=i-1;
while (f1(i)>=1)&&(f1(i)<2)
    h2(i-j)=hf1(i);
    fg2(i-j)=f1(i);
    i=i+1;
end
k=i-1;
while (f1(i)>=2)&&(f1(i)<3)
    h3(i-k)=hf1(i);
    fg3(i-k)=f1(i);
    i=i+1;
end

[B3,A3]=butter(5,[1,2],'s');
[hf3,f3]=freqs(B3,A3,1024);
i=1;
while f3(i)<1
    n1(i)=hf3(i);
    nm1(i)=f3(i);
    i=i+1;
end
j=i-1;
while (f3(i)>=1)&&(f3(i)<2)
    n2(i-j)=hf3(i);
    nm2(i-j)=f3(i);
    i=i+1;
end
k=i-1;
while (f3(i)>=2)&&(f3(i)<3)
    n3(i-k)=hf3(i);
    nm3(i-k)=f3(i);
    i=i+1;
end

axes(haxes2);
plot(fg1,abs(h1),'r');
axis([0.1,3,0,1.2]);
hold on;
%title('低通滤波特性');

axes(haxes1);
plot(nm1,abs(n1),'r');
axis([0.1,3,0,1.2]);
hold on;
%title('带阻滤波特性');
pause(1)
axes(haxes2);
plot(fg2,abs(h2),'k');
axis([0.1,3,0,1.2]);
hold on;
%title('低通滤波特性');
axes(haxes1);
plot(nm2,abs(n2),'k');
axis([0.1,3,0,1.2]);
hold on;
%title('带阻滤波特性');
pause(1)
axes(haxes2);
plot(fg3,abs(h3));
axis([0.1,3,0,1.2]);
hold on;
%title('低通滤波特性');
axes(haxes1);
plot(nm3,abs(n3));
axis([0.1,3,0,1.2]);
hold on;
%title('带阻滤波特性');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -