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

📄 fir_4type_sub.m

📁 很多matlab的源代码
💻 M
字号:
switch get (j1 ,'Value')
case 1
subplot(1,1,1);
h = [-4,1,-1,-2,5,6,5,-2,-1,1,-4];
M = length(h);
n = 0:M-1;
[Hr,w,a,L] = Hr_Type1(h)
amax = max(a) +1;
amin = min(a) -1;
subplot(3,3,4);
stem(n,h);
axis([-1 2*L+1 amin amax])
xlabel('n');
ylabel('h(n)');
title('脉冲响应');
subplot(3,3,7);
stem(0:L,a);
axis([-1 2*L+1 amin amax])
xlabel('n');
ylabel('a(n)');
title('a(n) 系数');
subplot(3,3,5);
plot(w/pi,Hr);grid
xlabel('零极点图');
ylabel('Hr');
title('Type=1 振幅响应');
subplot(3,3,8);
zplane(h,1)   
case 2
subplot(1,1,1)
h = [-4,1,-1,-2,5,6,6,5,-2,-1,1,-4];
M = length(h);
n = 0:M-1;
[Hr,w,b,L] = Hr_Type2(h)
bmax = max(b) +1;
bmin = min(b) -1;
subplot(3,3,4);
stem(n,h);
axis([-1 2*L+1 bmin bmax])
xlabel('n');
ylabel('h(n)');
title('脉冲响应');
subplot(3,3,7);
stem(1:L,b);
axis([-1 2*L+1 amin amax])
xlabel('n');
ylabel('b(n)');
title('b(n) 系数');
subplot(3,3,5);
plot(w/pi,Hr);grid
xlabel('零极点图');
ylabel('Hr');
title('Type=2 振幅响应');
subplot(3,3,8);
zplane(h,1)
case 3
subplot(1,1,1);
h = [-4,1,-1,-2,5,0,-5,2,-1,1,-4];
M = length(h);
n = 0:M-1;
[Hr,w,c,L] = Hr_Type3(h)
cmax = max(c) +1;
cmin = min(c) -1;
subplot(3,3,4);
stem(n,h);
axis([-1 2*L+1 cmin cmax])
xlabel('n');
ylabel('h(n)');
title('脉冲响应');
subplot(3,3,7);
stem(0:L,c);
axis([-1 2*L+1 cmin cmax])
xlabel('n');
ylabel('c(n)');
title('c(n) 系数');
subplot(3,3,5);
plot(w/pi,Hr);grid
xlabel('零极点图');
ylabel('Hr');
title('Type-3 振幅响应');
subplot(3,3,8);
zplane(h,1)
case 4
subplot(1,1,1);
h = [-4,1,-1,-2,5,6,-6,-5,2,1,-1,-4];
M = length(h);
n = 0:M-1;
[Hr,w,d,L] = Hr_Type4(h)
dmax = max(d) +1;
dmin = min(d) -1;
subplot(3,3,4);
stem(n,h);
axis([-1 2*L+1 dmin dmax])
xlabel('n');
ylabel('h(n)');
title('脉冲响应');
subplot(3,3,7);
stem(1:L,d);
axis([-1 2*L+1 dmin dmax])
xlabel('n');
ylabel('d(n)');
title('d(n) 系数');
subplot(3,3,5);
plot(w/pi,Hr);grid
xlabel('零极点图');
ylabel('Hr');
title('Type-4 振幅响应');
subplot(3,3,8);
zplane(h,1)
end

⌨️ 快捷键说明

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