• 《DSP using MATLAB》Problem 4.11


    代码:

    %% ----------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 4.11 
    
    ');
    
    banner();
    %% ----------------------------------------------------------------------------
    
    format rat;
    %% -------------------------------------------------
    %%            1      X1(z)    rightsided
    %% -------------------------------------------------
    
    b = [1, -1, -4, 4];             nb = [0:3]; 
    a = [1, -11/4, 13/8, -1/4];     na = [0:3];                 
    
    %[p, r] = deconv(b, a)
    %[p, np, r, nr] = deconv_m(b, nb, a, na)
    [R, p, C] = residuez(b, a)
    
    %[delta, n] = impseq(0,0,7);
    %x = filter(b, a, delta)
    
    %[b,a] = residuez(R, p, C)
    
    %Mp = abs((p))'
    %Ap = angle((p))'
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.11.1  X1(z)')
    set(gcf,'Color','white'); 
    zplane(b, a);                                           % row vector
    title('Zero-Pole Plot');  xlabel('Re'); ylabel('Im'); grid on;
    
    
    
    fprintf('
    -------------------- X2(z) ------------------ 
    
    ');
    %% -------------------------------------------------
    %%            2      X2(z)    absolutely summable
    %% -------------------------------------------------
    
    b = [1, 1, -4, 4];              nb = [0:3]; 
    a = [1, -11/4, 13/8, -1/4];     na = [0:3];                 
    
    %[p, r] = deconv(b, a)
    %[p, np, r, nr] = deconv_m(b, nb, a, na)
    [R, p, C] = residuez(b, a)
    
    %[delta, n] = impseq(0,0,7);
    %x = filter(b, a, delta)
    
    %[b,a] = residuez(R, p, C)
    
    %Mp = abs((p))'
    %Ap = angle((p))'
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.11.2 X2(z)')
    set(gcf,'Color','white'); 
    zplane(b, a);                                           % row vector
    title('Zero-Pole Plot');  xlabel('Re'); ylabel('Im'); grid on;
    
    
    
    fprintf('
    -------------------- X3(z) ------------------ 
    
    ');
    %% -------------------------------------------------
    %%            3      X3(z)    leftsided
    %% -------------------------------------------------
    
    b = [1, -3, 4, 1];              nb = [0:3]; 
    a = [1, -4, 1, -0.16];          na = [0:3];                 
    
    %[p, r] = deconv(b, a)
    %[p, np, r, nr] = deconv_m(b, nb, a, na)
    [R, p, C] = residuez(b, a)
    
    %[delta, n] = impseq(0,0,7);
    %x = filter(b, a, delta)
    
    %[b,a] = residuez(R, p, C)
    
    Mp = abs((p))'
    Ap = angle((p))'/pi              % pole angle in pi units
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.11.3 X3(z)')
    set(gcf,'Color','white'); 
    zplane(b, a);                                           % row vector
    title('Zero-Pole Plot');  xlabel('Re'); ylabel('Im'); grid on;
    
    
    fprintf('
    -------------------- X4(z) ------------------ 
    
    ');
    %% -------------------------------------------------
    %%            4      X4(z)    leftsided
    %% -------------------------------------------------
    
    b = [0, 0, 1];                  nb = [0:2]; 
    a = [1, 2, 1.25, 0.25];         na = [0:3];                 
    
    %[p, r] = deconv(b, a)
    %[p, np, r, nr] = deconv_m(b, nb, a, na)
    [R, p, C] = residuez(b, a)
    
    %[delta, n] = impseq(0,0,7);
    %x = filter(b, a, delta)
    
    %[b,a] = residuez(R, p, C)
    
    %Mp = abs((p))'
    %Ap = angle((p))'
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.11.4 X4(z)')
    set(gcf,'Color','white'); 
    zplane(b, a);                                           % row vector
    title('Zero-Pole Plot');  xlabel('Re'); ylabel('Im'); grid on;
    
    
    fprintf('
    -------------------- X5(z) ------------------ 
    
    ');
    %% -------------------------------------------------
    %%            5      X5(z)    leftsided
    %% -------------------------------------------------
    
    b = [0, 0, 0, 1];                  nb = [0:3]; 
    a = [1, 0, -0.5, 0, 0.25*0.25];    na = [0:3];                 
    
    %[p, r] = deconv(b, a)
    %[p, np, r, nr] = deconv_m(b, nb, a, na)
    [R, p, C] = residuez(b, a)
    
    %[delta, n] = impseq(0,0,7);
    %x = filter(b, a, delta)
    
    %[b,a] = residuez(R, p, C)
    
    %Mp = abs((p))'
    %Ap = angle((p))'
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.11.5 X5(z)')
    set(gcf,'Color','white'); 
    zplane(b, a);                                           % row vector
    title('Zero-Pole Plot');  xlabel('Re'); ylabel('Im'); grid on;
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    我的vim开发环境搭建:C/C++/Go,持续更新中
    MFC的组合框(ComboBox)控件切换下拉样式
    回顾下杂乱的10月
    C++将整型数据转换成大端或小端存储顺序
    C/C++动态分配连续空间,下标越界导致的free():invalid next size问题
    O(n)空间复杂度,打印杨辉三角形的前n行
    C指针笔试题,蛋疼的多重指针运算,谭浩强的阴影
    2017滴滴出行笔试题:异或和为0的最大区间个数
    manjaro安装
    关于top命令
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/8531386.html
Copyright © 2020-2023  润新知