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

    代码:

    x1 = [1,2,2,1]; x2 = [1,-1,-1,1]; 
    x3 = conv(x1,x2);             % N = 5
    
    n1 = 0:1:length(x1)-1;
    n2 = 0:1:length(x2)-1;
    
    n3 = 0:1:length(x3)-1;
    
    %% -----------------------------------------------------------------
    %%                  START   a
    %% -----------------------------------------------------------------
    figure('NumberTitle', 'off', 'Name', 'Exameple5.16a ')
    set(gcf,'Color','white'); 
    subplot(3,1,1); stem(n1,x1); title('sequence x1(n)'); axis([0,5,0,5]);
    xlabel('n'); ylabel('x1(n)'); grid on;
    subplot(3,1,2); stem(n2,x2); title('sequence x2(n)'); axis([0,5,0,5]);
    xlabel('n'); ylabel('x2(n)'); grid on;
    subplot(3,1,3); stem(n3,x3); title('Linear Convolution sequence x3(n)'); axis([0,10,-3,5]);
    xlabel('n'); ylabel('x3(n)'); grid on;
    
    
    %% -----------------------------------------------------------------
    %%                  END   a
    %% -----------------------------------------------------------------
    
    
    x4 = circonvt(x1,x2,7);            % N = 7
    
    n4 = 0:1:length(x4)-1;
    
    %% -----------------------------------------------------------------
    %%                  START   b
    %% -----------------------------------------------------------------
    figure('NumberTitle', 'off', 'Name', 'Exameple5.16b ')
    set(gcf,'Color','white'); 
    subplot(3,1,1); stem(n1,x1); title('sequence x1(n)'); axis([0,5,0,5]);
    xlabel('n'); ylabel('x1(n)'); grid on;
    subplot(3,1,2); stem(n2,x2); title('sequence x2(n)'); axis([0,5,0,5]);
    xlabel('n'); ylabel('x2(n)'); grid on;
    subplot(3,1,3); stem(n4,x4); title('Circularly convolution sequence x4(n)'); axis([0,10,-3,5]);
    xlabel('n'); ylabel('x4(n)'); grid on;
    
    
    %% -----------------------------------------------------------------
    %%                  END   b
    %% -----------------------------------------------------------------
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    linux下解除端口占用
    设计模式(二)观察者模式
    设计模式(一) 策略模式
    loj #6235. 区间素数个数
    loj #2013. 「SCOI2016」幸运数字
    loj #6014. 「网络流 24 题」最长 k 可重区间集
    loj #6013. 「网络流 24 题」负载平衡
    loj #2255. 「SNOI2017」炸弹
    loj #2051. 「HNOI2016」序列
    loj #6122. 「网络流 24 题」航空路线问题
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6163129.html
Copyright © 2011-2022 走看看