代码:

%
r = 0.9; theta = (pi/180)*[-55:5:-35, 35:5:55]';
p = r*exp(j*theta); a = poly(p); b = 1; % Direct form: quantized coefficients
N = 15; [ahat, L, B] = QCoeff(a, N);
TITLE = sprintf('%i-bit (1+%i+%i) Precision', N+1, L, B); % Comparison of Pole-Zero Plots
figure('NumberTitle', 'off', 'Name', 'Exameple 6.26a')
set(gcf,'Color','white'); subplot(1, 2, 1); [HZ, HP, Hl] = zplane(1, a);
set(HZ, 'color', 'g', 'linewidth', 1);
set(HP, 'color', 'g', 'linewidth', 1);
set(Hl, 'color', 'b'); axis([-1.1, 1.1, -1.1, 1.1]); grid on;
title('Infinite Precision', 'fontsize', 10, 'fontweight', 'bold'); subplot(1, 2, 2); [HZhat, HPhat, Hlhat] = zplane(1, ahat);
set(HZhat, 'color', 'r', 'linewidth', 1);
set(HPhat, 'color', 'r', 'linewidth', 1);
set(Hlhat, 'color', 'b'); axis([-1.1, 1.1, -1.1, 1.1]); grid on;
title(TITLE, 'fontsize', 10, 'fontweight', 'bold'); % Cascade form: quantized coefficients: Same N
[b0, B0, A0] = dir2cas(b, a); [BAhat1, L1, B1] = QCoeff([B0, A0], N);
TITLE1 = sprintf('%i-bit (1+%i+%i) Precision', N+1, L1, B1);
Bhat1 = BAhat1(:, 1:3); Ahat1 = BAhat1(:, 4:6);
[bhat1, ahat1] = cas2dir(b0, Bhat1, Ahat1); figure('NumberTitle', 'off', 'Name', 'Exameple 6.26b')
set(gcf,'Color','white'); subplot(1, 2, 1); [HZhat1, HPhat1, Hlhat1] = zplane(bhat1, ahat1);
set(HZhat1, 'color', 'g', 'linewidth', 1);
set(HPhat1, 'color', 'g', 'linewidth', 1);
set(Hlhat1, 'color', 'b'); axis([-1.1, 1.1, -1.1, 1.1]); grid on;
title(TITLE1, 'fontsize', 10, 'fontweight', 'bold'); % Cascade fomr: quantized coefficients: Same B (N=L1+B)
N1 = L1 + B; [BAhat2, L2, B2] = QCoeff([B0, A0], N1);
TITLE2 = sprintf('%i-bit (1+%i+%i) Precision', N1+1, L2, B2);
Bhat2 = BAhat2(:, 1:3); Ahat2 = BAhat2(:, 4:6);
[bhat2, ahat2] = cas2dir(b0, Bhat2, Ahat2); subplot(1, 2, 2); [HZhat2, HPhat2, Hlhat2] = zplane(bhat2, ahat2);
set(HZhat2, 'color', 'r', 'linewidth', 1);
set(HPhat2, 'color', 'r', 'linewidth', 1);
set(Hlhat2, 'color', 'b'); axis([-1.1, 1.1, -1.1, 1.1]); grid on;
title(TITLE2, 'fontsize', 10, 'fontweight', 'bold');

  结果:

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

  1. 《DSP using MATLAB》Problem 7.26

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

  2. 《DSP using MATLAB》Problem 8.26

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

  3. 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 ...

  4. DSP using MATLAB 示例 Example3.19

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

  5. DSP using MATLAB示例Example3.18

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

  6. 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 ...

  7. DSP using MATLAB 示例Example3.22

    代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...

  8. DSP using MATLAB 示例Example3.17

  9. DSP using MATLAB示例Example3.16

    代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, ...

  10. DSP using MATLAB 示例 Example3.15

    上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...

随机推荐

  1. 解决虚拟机安装64位系统“此主机支持 Intel VT-x,但 Intel VT-x 处于禁用状态”的问题

    环境说明:系统:Windows 8.1  简体中文专业版 虚拟机:VMware Workstation 11.0.0 报错:此主机支持 Intel VT-x,但 Intel VT-x 处于禁用状态.如 ...

  2. svn diff color

    大致有两种方式: 1,在bashrc中添加如下脚本 svndiff() { svn diff "${@}" | colordiff } 2,修改svn的配置文件 $ vim ~/. ...

  3. 微信小程序------联动选择器

    picker 从底部弹起的滚动选择器,现支持五种选择器,通过mode来区分,分别是普通选择器,多列选择器,时间选择器,日期选择器,省市区选择器,默认是普通选择器. 先来看看效果图: 1:普通选择器 m ...

  4. Linux命令详解-pwd

    Linux中用 pwd 命令来查看"当前工作目录"的完整路径. 简单得说,每当你在终端进行操作时,你都会有一个当前工作目录. 在不太确定当前位置时,就会使用pwd来判定当前目录在文 ...

  5. Hibernate[延迟加载] [三种状态] [脏检查] [缓存机制]

    一.持久化对象的唯一标识 java中按内存地址不同区分同一个类的不同对象,关系数据库用主键区分同一条记录,Hibernate使用OID来建立内存中的对象和数据库中记录的对应关系 什么是OID? 解析: ...

  6. webapi返回不带引号的字符串,解决自动加双引号的问题

    返回类型改为HttpResponseMessage类型 [Route("api/TestControllers/test")] [HttpGet] public HttpRespo ...

  7. CF 187C Weak Memory 优先队列 难度:2

    http://codeforces.com/problemset/problem/187/C 这道题可以用二分+dfs检测,或者优先队列解 此处用了优先队列解法 从起点出发,维护一个优先队列,内容是p ...

  8. 【LeetCode 228_数组】Summary Ranges

    vector<string> summaryRanges(vector<int>& nums) { int nums_len = nums.size(); vector ...

  9. Conky配置文件

    Conky是一个可以在linux系统中实时显示系统性能的工具,美观且十分好用,我们选择安装conky-all程序包 # set to yes if you want Conky to be forke ...

  10. vue.js 源代码学习笔记 ----- 工具方法 option

    /* @flow */ import Vue from '../instance/index' import config from '../config' import { warn } from ...