代码:

%
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. Eclipse-环境搭建(缅怀篇)

    JDK 下载jdk安装并配置环境变量运行java -version查看是否安装配置成功 Eclipse 下载eclipse,直接解压到目录 eclipse配置jre 设置complie编译等级 Ecl ...

  2. java网络编程之图片上传

    输入输出流核心代码 所有的文件传输都是靠流,其中文件复制最具代表性.输入流和输出流,从输入流中读取数据写入到输出流中. InputStream in = 输入源; OutputStream os = ...

  3. hdu3706单调队列

    很基础的单调队列 #include<map> #include<set> #include<cmath> #include<queue> #includ ...

  4. Oracle like '%...%' 优化

    Oracle like '%...%' 优化 1.尽量不要使用 like '%%' 2.对于 like '%' (不以 % 开头),Oracle可以应用 colunm上的index 3.对于 like ...

  5. java之JDBC多条语句执行

    在开发过程中,有时我们需要执行多条SQL语句,那如何处理才能解决这样的问题? 1,多条语句执行错误 原因:试图用一个PreparedStatement对象,执行多次SQL操作.程序会提示一下错误: O ...

  6. nyoj——297(期望)

    GoroSort 时间限制:3000 ms  |  内存限制:65535 KB 难度:4   描述 Goro has 4 arms. Goro is very strong. You don't me ...

  7. Nginx1.8 安装说明

    安装Nginx .安装pcre cd /usr/local/src mkdir /usr/local/pcre tar zxvf pcre-8.36.tar.gz cd pcre-8.36 ./con ...

  8. 验证email是否合法

    https://buluo.qq.com/p/detail.html?bid=339910&pid=6675390-1514450689&from=grp_sub_obj 场景1:验证 ...

  9. js生成中文二维码

    http://www.cnblogs.com/xcsn/archive/2013/08/14/3258035.html http://www.jb51.net/article/64928.htm 使用 ...

  10. 020——VUE中变异方法push的留言版实例讲解

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...