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

    代码:

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 6.23 
    
    ');
    
    banner();
    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    %format long;
    format short;
    
    broots = [0.5*exp(j*pi/3),  0.5*exp(-j*pi/3),  2*exp(j*pi/3), 2*exp(-j*pi/3), ...
    	      0.25*exp(j*pi/6), 0.25*exp(-j*pi/6), 4*exp(j*pi/6), 4*exp(-j*pi/6)]
    
    
    fprintf('
    Convert DIRECT-form to Cascade of Two Linear-Phase form :     
    ');
    B1 = real( poly( [broots(1:4)] ) )
    B2 = real( poly( [broots(5:8)] ) )
    
    
    fprintf('
     FIR filter DIRECT-form:     
    ');
    b = real( poly(broots) )
    a = 1.0
    
    
    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 FREQUENCY-SAMPLE-form 1 :     
    ');
    [Cfs, Bfs, Afs] = dir2fs(b) 
    
    fprintf('
    Convert DIRECT-form to FREQUENCY-SAMPLE-form 2 :     
    ');
    r = 0.99;
    [Cfs_r, Bfs_r, Afs_r, rM] = dir2fs_r(b, r) 
    
    
    % ----------------------------------------------------------
    % NOTE: linear-phase can not use LATTICE-form
    % ----------------------------------------------------------
    fprintf('
    Convert DIRECT-form to All-Zero LATTICE-form :     
    ');
    [Klc] = dir2latc(b) 
    
    
    % -----------------------------------------
    %     START check
    % -----------------------------------------
    n = [0:7];
    delta = impseq(0, 0, 7)
    %format long
    format  short
    hcas = casfiltr(b0, Bc, Ac, delta)
    
    hltc = latcfilt(Klc, delta)
    
    %hladr = ladrfilt(Klr, Clr, delta)
    
    hdir = filter(b, a, delta)
    % -------------------------------------------
    %       END check
    % -------------------------------------------
    

      运行结果:

            8个零点,即系统函数的分子多项式的根

            根据线性相位FIR的特点,前4个零点和后4个零点可分为两组,即看成两个线性相位FIR

            串联形式系数

            频率采样形式系数

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    BZOJ 2300凸包+离线
    BZOJ 4140 凸包+二进制分组
    BZOJ 2178 Simpson积分
    BZOJ 4828 DP+BFS
    BZOJ 1845 Simpson积分
    BZOJ 1137 半平面交
    Codeforces 803G Periodic RMQ Problem ST表+动态开节点线段树
    Codeforces Round 411 Div.2 题解
    BZOJ 4530 LCT/线段树合并
    BZOJ 2946 SA/SAM
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/10289191.html
Copyright © 2011-2022 走看看