代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 8.37 \n\n'); banner();
%% ------------------------------------------------------------------------ % Digital Filter Specifications: Chebyshev-2 bandpass
ws = [0.30*pi 0.60*pi]; % digital stopband freq in rad
wp = [0.40*pi 0.50*pi]; % digital passband freq in rad
Rp = 0.50; % passband ripple in dB
As = 50; % stopband attenuation in dB Ripple = 10 ^ (-Rp/20) % passband ripple in absolute
Attn = 10 ^ (-As/20) % stopband attenuation in absolute % Calculation of Chebyshev-2 filter parameters:
[N, wn] = cheb2ord(wp/pi, ws/pi, Rp, As); fprintf('\n ********* Chebyshev-2 Digital Bandpass Filter Order is = %3.0f \n', 2*N) % Digital Chebyshev-2 Bandpass Filter Design:
[bbp, abp] = cheby2(N, As, wn); [C, B, A] = dir2cas(bbp, abp) % Calculation of Frequency Response:
%[dblp, maglp, phalp, grdlp, wwlp] = freqz_m(blp, alp);
[dbbp, magbp, phabp, grdbp, wwbp] = freqz_m(bbp, abp); % ---------------------------------------------------------------
% find Actual Passband Ripple and Min Stopband attenuation
% ---------------------------------------------------------------
delta_w = 2*pi/1000;
Rp_bp = -(min(dbbp(ceil(wp(1)/delta_w+1):1:ceil(wp(2)/delta_w+1)))); % Actual Passband Ripple fprintf('\nActual Passband Ripple is %.4f dB.\n', Rp_bp); As_bp = -round(max(dbbp(1:1:ceil(ws(1)/delta_w)+1))); % Min Stopband attenuation
fprintf('\nMin Stopband attenuation is %.4f dB.\n\n', As_bp); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Problem 8.37 Chebyshev-2 bp by cheby2 function')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(wwbp/pi, magbp); axis([0, M, 0, 1.2]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.9441, 1]); subplot(2,2,2); plot(wwbp/pi, dbbp); axis([0, M, -100, 2]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-80, -50, -1, 0]);
set(gca,'YTickLabelMode','manual','YTickLabel',['80'; '50';'1 ';' 0']); subplot(2,2,3); plot(wwbp/pi, phabp/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('Digital frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]); subplot(2,2,4); plot(wwbp/pi, grdbp); axis([0, M, 0, 40]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:10:40]);

  运行结果:

通带、阻带绝对指标

用cheby2函数(MATLAB自带),设计数字低通原型滤波器,阶数为5,系统函数串联形式的系数为

Chebyshev-2型数字低通,幅度谱、相位谱和群延迟响应

《DSP using MATLAB》Problem 8.37的更多相关文章

  1. 《DSP using MATLAB》Problem 5.37

    证明过程: 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  2. 《DSP using MATLAB》Problem 7.37

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  3. 《DSP using MATLAB》Problem 8.32

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  4. 《DSP using MATLAB》Problem 7.36

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  5. 《DSP using MATLAB》Problem 7.27

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  6. 《DSP using MATLAB》Problem 7.26

    注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...

  7. 《DSP using MATLAB》Problem 7.25

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  8. 《DSP using MATLAB》Problem 7.24

    又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...

  9. 《DSP using MATLAB》Problem 7.23

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...

随机推荐

  1. thinkphp cookie支持

    系统内置了一个cookie函数用于支持和简化Cookie的相关操作,该函数可以完成Cookie的设置.获取.删除操作. Cookie设置 cookie('name','value'); //设置coo ...

  2. PHP ftp_rename() 函数

    定义和用法 ftp_rename() 函数重命名 FTP 服务器上的文件或目录. 如果成功,该函数返回 TRUE.如果失败,则返回 FALSE. 语法 ftp_rename(ftp_connectio ...

  3. csp-s模拟测试97

    csp-s模拟测试97 猿型毕露.水题一眼秒,火题切不动,还是太菜了. $T1$看了一会儿感觉$woc$期望题$T1??$假的吧??. $T2$秒. $T3$什么玩意儿. 40 01:24:46 00 ...

  4. hdu多校第十场 1009 (hdu6699) Block Breaker bfs/模拟

    题意: 紧密排列的方块因为摩擦力一个一个稳定地挤在一起,但当一个方块的四个邻居中,上下两个至少空缺一个,左右两个至少空缺一个,则这个方块也将掉落. 每次锤掉一个方块,求多少个方块受牵连落下. 题解: ...

  5. HDU6440 Dream 2018CCPC网络赛-费马小定理

    目录 Catalog Solution: (有任何问题欢迎留言或私聊 && 欢迎交流讨论哦 Catalog Problem:Portal传送门  原题目描述在最下面.  给定一个素数p ...

  6. Putty 两步代理访问互联网

    工作在机房,有时需要访问外网. 此时浏览器需要使用代理服务器,访问的流程如下: 由于SERVER2不能直接访问互联网,而SERVER3可以(机房无法直接访问SERVER3)所以需要两步代理. 配置流程 ...

  7. 剑指offer——24链表中倒数第k个结点

    题目描述 输入一个链表,输出该链表中倒数第k个结点.   题解: 1.普通解法,先遍历一遍计算链表长度,然后遍历到倒数第k个节点: 2.只遍历一遍,使用双指针,使得头尾指针位差为k,那么当尾指针为空时 ...

  8. Day 9 :初识函数

    Python函数:1.函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 2.函数能提高应用的模块性,和代码的重复利用率. Python提供了许多内建函数,比如print().但你也可 ...

  9. Scala 学习2

    去map里面的数据 scala> val map = Map("a"->1, "b"->2, "c"->3) map ...

  10. 【牛客提高训练营5B】旅游

    题目 吉老师的题时过一年还是不会做 从\(1\)号点出发经过每条边至少一次并且还要回到\(1\)号点,这跟欧拉回路的条件非常像,但是欧拉回路的实际上是"经过每一条边恰好一次并且回到出发点&q ...