zoukankan      html  css  js  c++  java
  • 《DSP using MATLAB》Problem 6.7

    代码:

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 6.7 
    
    ');
    
    banner();
    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    b1 = [2   0  2];  nb1 = [0:2];
    b2 = [2  -1];     nb2 = [0:1];
    b3 = [1   2  1];  nb3 = [0:2];
    
    a1 = [1  -0.8   0.64]; na1 = [0:2];
    a2 = [1  -0.75];       na2 = [0:1];
    a3 = [1   0     0.81]; na3 = [0:2];
    
    a11 = conv(a1, a2); b11 = conv(b1, a2) + conv(b2, a1);
    
    
    fprintf('
    Direct form: 
    ');
    b = conv(b11, a3) + conv(b3, a11)
    a = conv(a11, a3)
    
    
    fprintf('
    Convert DIRECT-form to PARALLEL-form :     
    ');
    [C, Bp, Ap] = dir2par(b, a)
    
    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
    % -------------------------------------------
    
    
    figure('NumberTitle', 'off', 'Name', 'P6.7 hcas(n), hpar(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem(n, hcas); 
    xlabel('n'); ylabel('hcas(n)');
    title('hcas(n)');  grid on;
    subplot(2,1,2); stem(n, hpar); 
    xlabel('n'); ylabel('hpar(n)');
    title('hpar(n)');  grid on;
    
    figure('NumberTitle', 'off', 'Name', 'P6.7 hladr(n) hdir(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem(n, hladr); 
    xlabel('n'); ylabel('hladr(n)');
    title('hladr(n)');  grid on;
    subplot(2,1,2); stem(n, hdir);  
    xlabel('n'); ylabel('hdir(n)');
    title('hdir(n)');  grid on;
    

      运行结果:

           直接形式系数

            串联形式系数

            并联形式系数

            格型系数

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    js点击显示全部内容(用于内容比较长时)
    vs中运行时如何去除虚拟目录
    selenium使用中的几个问题
    解决播客程序不能播放Flv文件的问题
    VS2005 + VSS6.0 简单应用示例
    IList转换为DataTable
    asp.net根据生日计算年龄(具体到年月天)
    vs2005菜单中没有显示源代码管理怎么办
    asp.net解决中文乱码问题
    跨域删除cookie的问题
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/9608907.html
Copyright © 2011-2022 走看看