代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.17 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %8s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ % Digital Filter Specifications:
wp = 0.2*pi; % digital passband freq in rad
ws = 0.3*pi; % digital stopband freq in rad
Rp = 1; % passband ripple in dB
As = 15; % stopband attenuation in dB % Analog prototype specifications: Inverse Mapping for frequencies
T = 1; Fs = 1/T; % set T = 1
OmegaP = (2/T)*tan(wp/2); % Prewarp(Cutoff) prototype passband freq
OmegaS = (2/T)*tan(ws/2); % Prewarp(cutoff) prototype stopband freq % Analog Butterworth Prototype Filter Calculation:
[cs, ds] = afd_butt(OmegaP, OmegaS, Rp, As); % Bilinear Transformation:
[b, a] = bilinear(cs, ds, T); [C, B, A] = dir2cas(b, a) % Calculation of Frequency Response:
[db, mag, pha, grd, ww] = freqz_m(b, a); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Exameple 8.17')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
xlabel(' frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.1778, 0.8913, 1]); subplot(2,2,2); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:1:1]); subplot(2,2,3); plot(ww/pi, db); axis([0, M, -30, 10]); grid on;
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB ');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-30, -15, -1, 0]); subplot(2,2,4); plot(ww/pi, grd); axis([0, M, 0, 15]); grid on;
xlabel('frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:5:15]);

  运行结果:

《DSP using MATLAB》示例Example 8.17的更多相关文章

  1. 《DSP using MATLAB》Problem 6.17

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

  2. 《DSP using MATLAB》Problem 5.17

    1.代码 %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% ...

  3. 《DSP using MATLAB》Problem 3.17

    用差分方程两边进行z变换,再变量带换得到频率响应函数(或转移函数,即LTI系统脉冲响应的DTFT). 代码: %% ------------------------------------------ ...

  4. 《DSP using MATLAB》Problem 2.17

    1.代码: %% ------------------------------------------------------------------------ %% Output Info abo ...

  5. 《DSP using MATLAB》Problem 8.17

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

  6. DSP using MATLAB 示例Example3.17

  7. DSP using MATLAB 示例Example3.21

    代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...

  8. DSP using MATLAB 示例 Example3.19

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...

  9. DSP using MATLAB示例Example3.18

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...

  10. DSP using MATLAB 示例Example3.23

    代码: % Discrete-time Signal x1(n) : Ts = 0.0002 Ts = 0.0002; n = -25:1:25; nTs = n*Ts; x1 = exp(-1000 ...

随机推荐

  1. no crontab for root 解决方案

    root用户下 输入 crontab -l 显示 no crontab for root  例如: [root@localhost ~]# crontab -l no crontab for root ...

  2. 值得推荐的10本PHP书籍(转)

    值得推荐的10本PHP书籍(转) 一.总结 一句话总结: 二.值得推荐的10本PHP书籍 本篇文章的目的是想较全面地推荐10本PHP书籍,暂不讨论Linux/NGINX/Mysql等其他丛书. 前言 ...

  3. JavaScript_正则表达式

    [规则]开头结尾    "^The":表示所有以"The"开始的字符串("There","The cat"等):    ...

  4. Knockout结合Bootstrap创建动态UI--产品列表管理

    本篇文章结合Bootstrap创建一个比较完整的应用,对产品列表进行管理,包括产品的增加.删除.修改. 需要的引用 <script type='text/javascript' src='htt ...

  5. HTML子页面保存关闭并刷新父页面

    1.思路是子页面保存后,后台传递成功的js到前台. 2.js的原理是——子页面调用父页面的刷新 子页面 function Refresh() {            window.parent.Re ...

  6. 1-13 RHEL7-硬盘介绍和磁盘管理

    熟悉Linux平台下的存储介质,LVM逻辑卷.RAID 磁盘陈列等 大纲: 1-1  硬盘的分类及使用fdisk分区工具       1-1-1 认识硬盘的分类和特性.SCSI.IDE.SAS.SAT ...

  7. DRUID连接池的使用

    DRUID介绍    DRUID是阿里巴巴开源平台上一个数据库连接池实现,它结合了C3P0.DBCP.PROXOOL等DB池的优点,同时加入了日志监控,可以很好的监控 DB池连接和SQL的执行情况,可 ...

  8. Python 序列化pickle/cPickle模块整理

    Python序列化的概念很简单.内存里面有一个数据结构,你希望将它保存下来,重用,或者发送给其他人.你会怎么做?这取决于你想要怎么保存,怎么重用,发送给谁.很多游戏允许你在退出的时候保存进度,然后你再 ...

  9. Ansible 开发调试 之【pycharm远程调试】

    介绍 PyCharm是一种Python IDE,带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,比如调试.语法高亮.Project管理.代码跳转.智能提示.自动完成.单元测试.版本 ...

  10. Roman Numeral Converter

    将给定的数字转换成罗马数字. 所有返回的 罗马数字 都应该是大写形式. 这是一些对你有帮助的资源: Roman Numerals Array.splice() Array.indexOf() Arra ...