• 《DSP using MATLAB》Problem 5.12


            1、从别的地方找的证明过程:

            2、代码

    function x2 = circfold(x1, N)
    %% Circular folding using DFT 
    %% ---------------------------------------------
    %% x2 = circfold(x1, N)
    %% x2 = circulary folded output sequence
    %% x1 = input sequence of length <= N
    %%  N = circular buffer length 
    %% 
               
    X1k_DFT = dft(x1, N);
    Xk = dft(X1k_DFT, N);
    x2 = Xk/N;
    

      

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 5.12 
    
    ');
    
    banner();
    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    % --------------------------------------------------------------
    %              1  x(n) = [1, 3, 5, 7, 9, -7, -5, -3, -1]                                      
    % --------------------------------------------------------------
    
    xx1 = [1, 3, 5, 7, 9, -7, -5, -3, -1];
    NN1 = length(xx1);                              % length is 6
    nn1 = [0 : NN1-1];
    
    
    % ----------------------------------------------------
    %             1st way to get Circulary folded
    % ----------------------------------------------------
    xx1_cf = xx1( mod(-nn1, NN1)+1 );
    
    
    figure('NumberTitle', 'off', 'Name', 'P5.12 x(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem(nn1, xx1);
    xlabel('n'); ylabel('x(n)');
    title('x(n) ori sequence');  grid on;
    subplot(2,1,2); stem(nn1, xx1_cf);
    xlabel('n'); ylabel('x(n)');
    title('x((-n))_N Circulary folded by mod way');  grid on;
    
    
    % ------------------------------------------------------
    %         2nd way to get Circulary folded
    %              DFT
    % ------------------------------------------------------
    
    
    xx2 = circfold(xx1, NN1);
    
    figure('NumberTitle', 'off', 'Name', 'P5.12 x(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem(nn1, xx1);
    xlabel('n'); ylabel('x(n)');
    title('x(n) ori sequence');  grid on;
    subplot(2,1,2); stem(nn1, xx2);
    xlabel('n'); ylabel('x(n)');
    title('x((-n))_N Circulary folded by DFT way');  grid on;
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    225. 用队列实现栈
    415. 字符串相加
    rabbitmq的基本使用
    3. 无重复字符的最长子串
    面试题59
    面试题30. 包含min函数的栈
    面试题09. 用两个栈实现队列
    287. 寻找重复数
    1137. 第 N 个泰波那契数
    70. 爬楼梯
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/9360859.html
Copyright © 2020-2023  润新知