• 《DSP using MATLAB》Problem 2.9


    代码:

    %% ------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 2.9 
    
    ');
    
    banner();
    %% ------------------------------------------------------------------------
    
    nx = [0:1:20]; 
     x = 0.9 .^ nx;
    
    ny = [-20:1:0];
     y = 0.8 .^ (-ny); 
    
    figure('NumberTitle', 'off', 'Name', 'Problem 2.9')
    set(gcf,'Color',[1,1,1])                  % 改变坐标外围背景颜色
    
    subplot(2,1,1); stem(nx, x); title('x sequence');
    xlabel('n'); ylabel('x(n)') ;
    grid on
    subplot(2,1,2); stem(ny, y); title('y sequence');
    xlabel('n'); ylabel('y(m)');
    grid on;
    
    
    [x1, nx1] = sigfold(x, nx);           % obtain x(-n)
    [y1, ny1] = sigfold(y, ny);
    
    [Rxy, nxy] = conv_m(x1, nx1, y, ny);
    [Rxx, nxx] = conv_m(x1, nx1, x, nx);
    
    
    figure('NumberTitle', 'off', 'Name', 'Problem 2.9')
    set(gcf,'Color',[1,1,1])                  % 改变坐标外围背景颜色
    
    subplot(2,1,1); stem(nxy, Rxy); title('Crosscorrelation Rxy(l) sequence');
    xlabel('nxy'); ylabel('Rxy(nxy)') ;
    grid on
    subplot(2,1,2); stem(nxx, Rxx); title('Autocorrelation Rxx(l) sequence');
    xlabel('nxx'); ylabel('Rxx(nxx)');
    grid on;
    

      

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    C++ 11 右值引用以及std::move
    poj2299--B
    Linux Socket编程注意事项
    Using Qt to build an Omi App for iOS (and Android)
    openwrt 3g模块上网
    详谈隐藏Tabbar的几种方法
    ZOJ 3529 A Game Between Alice and Bob(博弈论-sg函数)
    uva 10574
    【MySQL案例】HA: GTID_MODE配置不一致
    Swift UIView 层次调整
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/7994827.html
Copyright © 2020-2023  润新知