• 《DSP using MATLAB》示例Example 6.26


    代码:

    % 
    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');
    

      结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    NET領域模型(1)
    oracle 函數索引(1)
    oracle 動態SQL(1)
    WF事件驱动(5)
    WF事件驱动(3)
    WF事件驱动(4)
    HP LoadRunner 11.00 新鲜尝
    Tomcat配置优化要点
    WebSphere性能诊断与调优
    性能测试工具、监控工具
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6601460.html
Copyright © 2020-2023  润新知