• 《DSP using MATLAB》Problem 8.18


          代码:

    %% ------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 8.18 
    
    ');
    
    banner();
    %% ------------------------------------------------------------------------
    
    Wp = 20*pi; Ws = 30*pi; Rp = 0.25; As = 50;
    Fp = Wp/(2*pi);
    Fs = Ws/(2*pi);
    
    Ripple = 10 ^ (-Rp/20)
    Attn = 10 ^ (-As/20)
    
    % Analog filter design, DIRECT form:
    [b, a] = afd('ellip', Fp, Fs, Rp, As);
    %[b, a] = afd_elip(Wp, Ws, Rp, As);
    
    % Calculation of second-order sections:
    [C, B, A] = sdir2cas(b, a);
    
    % Calculation of Frequency Response:
    [db, mag, pha, ww] = freqs_m(b, a, 35*pi);
    
    % Calculation of Impulse Response:
    [ha, x, t] = impulse(b, a);
    
    
    %% -------------------------------------------------
    %%                    Plot
    %% -------------------------------------------------  
    
    figure('NumberTitle', 'off', 'Name', 'Problem 8.18 Lowpass Analog Elliptic')
    set(gcf,'Color','white'); 
    M = 1.0;                          % Omega max
    
    subplot(2,2,1); plot(ww/pi, mag);  grid on; axis([-45, 45, 0, 1.2]);
    xlabel(' Analog frequency in pi*1k units'); ylabel('|H|'); title('Magnitude in Absolute');
    set(gca, 'XTickMode', 'manual', 'XTick', [-30, -20, 0, 20, 30]);
    set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.003, 0.97, 1]);
    
    subplot(2,2,2); plot(ww/pi, db);  grid on; %axis([0, M, -50, 10]);
    xlabel('Analog frequency in pi*1k units'); ylabel('Decibels'); title('Magnitude in dB ');
    set(gca, 'XTickMode', 'manual', 'XTick', [-30, -20, 0, 20, 30]);
    set(gca, 'YTickMode', 'manual', 'YTick', [-70, -50, -1, 0]);
    set(gca,'YTickLabelMode','manual','YTickLabel',['70';'50';' 1';' 0']);
    
    subplot(2,2,3); plot(ww/pi, pha/pi);  grid on; axis([-45, 45, -1.2, 1.2]);
    xlabel('Analog frequency in pi*1k nuits'); ylabel('radians'); title('Phase Response');
    set(gca, 'XTickMode', 'manual', 'XTick', [-30, -20, 0, 20, 30]);
    set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]);
    
    
    subplot(2,2,4); plot(t, ha); grid on; %axis([0, 30, -0.05, 0.25]); 
    xlabel('time in seconds'); ylabel('ha(t)'); title('Impulse Response');
    

      运行结果:

           绝对指标

            模拟Elliptical低通,串联形式系数

            幅度谱、相位谱和脉冲响应

            通带放大

            阻带放大

            由图可知,通带、阻带,都是等波纹的。

  • 相关阅读:
    poj 2417 Discrete Logging
    洛谷 P2886 [USACO07NOV]牛继电器Cow Relays
    bzoj 3232 圈地游戏——0/1分数规划(或网络流)
    bzoj 4753 [Jsoi2016]最佳团体——0/1分数规划
    bzoj 5281 [Usaco2018 Open]Talent Show——0/1分数规划
    CF 949D Curfew——贪心(思路!!!)
    bzoj 3872 [Poi2014]Ant colony——二分答案
    bzoj 1731 [Usaco2005 dec]Layout 排队布局——差分约束
    洛谷 1344 [USACO4.4]追查坏牛奶Pollutant Control——最大流
    洛谷 1262 间谍网络——缩点+拓扑
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/11061463.html
Copyright © 2020-2023  润新知