• 《DSP using MATLAB》Problem 6.14


    代码:

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 6.14 
    
    ');
    
    banner();
    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    H1_C = 2;
    H1_a1 = [1   0.9  0.9]; H1_b1 = [0.2  -0.3];
    H1_a2 = [1  -0.8  0.8]; H1_b2 = [0.4   0.5];
    
    H2_a1 = [1   1.7  0.72]; H2_b1 = [2  1  -1];
    H2_a2 = [1  -1.5  0.56]; H2_b2 = [3  4   5];
    
    
    % ------------------------------------------------------
    %       1st way to get a and b
    % ------------------------------------------------------
    H1_a = conv(H1_a1, H1_a2)
    
    H1_b11 = conv(H1_b1, H1_a2) + conv(H1_b2, H1_a1);
    H1_b11 = [H1_b11 zeros(length(H1_a)-length(H1_b11))]
    
    H1_b = 2*H1_a + H1_b11
    
    
    H2_b = conv(H2_b1, H2_b2)
    H2_a = conv(H2_a1, H2_a2)
    
    format short;
    fprintf('
    1st way to get DIRECT-form:     
    ');
    a = conv(H1_a, H2_a)
    b = conv(H1_b, H2_a) + conv(H2_b, H1_a)
    
    
    fprintf('
    Convert DIRECT-form to PARALLEL-form :     
    ');
    [C, Bp, Ap] = dir2par(b, a)
    
    if size(C)==0
      C = 0;
    end
    
    fprintf('
    Convert DIRECT-form to CASCADE-form :     
    ');
    [b0, Bc, Ac] = dir2cas(b, a) 
    
    fprintf('
    Convert TF-form to SOS-form :     
    ');
    [sos, g] = tf2sos(b, a)
    
    fprintf('
    Convert DIRECT-form to LATTICE-LADDER-form :     
    ');
    [Klr, Clr] = dir2ladr(b, a) 
    
    fprintf('
    Convert DIRECT-form to MATLAB LATTICE-LADDER-form :     
    ');
    [K, V] = tf2latc(b, a)
    
    % -----------------------------------------
    %     START check
    % -----------------------------------------
    n = [0:7];
    delta = impseq(0, 0, 7)
    %format long
    format  short
    hcas = casfiltr(b0, Bc, Ac, delta)
    
    hpar = parfiltr(C, Bp, Ap, delta)
    
    hladr = ladrfilt(Klr, Clr, delta)
    
    hdir = filter(b, a, delta)
    % -------------------------------------------
    %       END check
    % -------------------------------------------
    
    fprintf('
    Convert CASCADE-form to DIRECT-form:     
    ');
    [b_c2d, a_c2d] = cas2dir(b0, Bc, Ac) 
    
    fprintf('
    Convert SOS-form to TF-form :     
    ');
    [b_s2t, a_s2t] = sos2tf(sos, g)
    

      运行结果:

           直接形式系数

            并联形式系数

            串联形式系数

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    关于Mac上的开发工具
    关于VS2008和VS2013中字体的选择
    实验四 使用ASP.NET内置对象 总结
    实验三 使用ASP.NET常用服务器控件 总结
    实验二 C#程序设计 总结
    实验一 ASP.NET应用环境配置 总结
    关于PHP.INI中的错误ERROR报告级别设置
    获取当前网址跟目录
    PHP获取站点根目录
    php 上传图片
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/9642579.html
Copyright © 2020-2023  润新知