zoukankan      html  css  js  c++  java
  • 《DSP using MATLAB》示例Example5.9

    代码:

    n = 0:10; x = 10*(0.8) .^ n; y = x(mod_1(-n,11)+1);
    
    %% -----------------------------------------------------------------
    %%                  START   a
    %% -----------------------------------------------------------------
    figure('NumberTitle', 'off', 'Name', 'Exameple5.9a x sequence')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem(n,x); title('Original sequence x(n)'); %axis([0,10,-2.5,2.5]);
    xlabel('n'); ylabel('x(n)'); grid on;
    subplot(2,1,2); stem(n,y); title('Circularly folded sequence y(n)'); %axis([0,10,-2.5,2.5]);
    xlabel('n'); ylabel('y(n)=x(-n mod 10)'); grid on;
    %% -----------------------------------------------------------------
    %%                  END   a
    %% -----------------------------------------------------------------
    
    
    %% -----------------------------------------------------------------
    %%              START   b
    %% -----------------------------------------------------------------
    X_DFT = dft(x,11);   Y_DFT = dft(y,11);                 % DFT of x and y
    
    realX_DFT = real(X_DFT); imagX_DFT = imag(X_DFT);
    realY_DFT = real(Y_DFT); imagY_DFT = imag(Y_DFT);
    
    figure('NumberTitle', 'off', 'Name', 'Exameple5.9b x sequence')
    set(gcf,'Color','white'); 
    subplot(2,2,1); stem(n,realX_DFT); title('Real {DFT[x(n)]}'); %axis([0,N,-0.5,1.5]);
    xlabel('k'); grid on;
    subplot(2,2,2); stem(n,imagX_DFT); title('Imag {DFT[x(n)]}'); %axis([0,N,-0.5,1.5]);
    xlabel('k'); grid on;
    subplot(2,2,3); stem(n,realY_DFT); title('Real {DFT[x((-n))11]}'); %axis([0,N,-0.5,1.5]);
    xlabel('k'); grid on;
    subplot(2,2,4); stem(n,imagY_DFT); title('Imag {DFT[x((-n))11]}'); %axis([0,N,-0.5,1.5]);
    xlabel('k'); grid on;
    %% -----------------------------------------------------------------
    %%                    END   b
    %% -----------------------------------------------------------------
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    MySQL难点语法——连接
    MySQL难点语法——子查询
    MySQL查询——select
    python高级编程——入门语法(二)
    python高级编程——入门语法(一)
    MySQL语言分类——DML
    python高级编程——锁
    浮点数的秘密
    有符号和无符号数
    基本数据类型
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6139808.html
Copyright © 2011-2022 走看看