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

    代码:

    %% ------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 2.15 
    
    ');
    
    banner();
    %% ------------------------------------------------------------------------
    
    
    nx1 = [-3:3]; x1 = [2, -4, 5, 3, -1, -2, 6]; 
    nh1 = [-1:3]; h1 = [1, -1, 1, -1, 1];
    
    nx2 = [-2:2]; x2 = [1, 1, 0, 1, 1];
    nh2 = [-3:0]; h2 = [1, -2, -3, 4];
    
    nx3 = [-2:6]; x3 = (0.25 .^ (-nx3)) .* (stepseq(-1, -2, 6) - stepseq(4, -2, 6));
    nh3 = [-2:6]; h3 = stepseq(0, -2, 6) - stepseq(5, -2, 6);
    
    nx4 = [-3:7]; x4 = (nx4/4) .* (stepseq(0, -3, 7) - stepseq(6, -3, 7)) ;
    nh4 = [-3:7]; h4 = 2 * (stepseq(-2, -3, 7) - stepseq(3, -3, 7));
    
    
    [y1, ny1] = conv_m(x1, nx1, h1, nh1);
    [y2, ny2] = conv_m(x2, nx2, h2, nh2);
    [y3, ny3] = conv_m(x3, nx3, h3, nh3);
    [y4, ny4] = conv_m(x4, nx4, h4, nh4);
    
    
    figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
    set(gcf,'Color',[1,1,1])                  % 改变坐标外围背景颜色
    
    subplot(3,1,1); stem(nx1, x1); title('x1 sequence');
    xlabel('n'); ylabel('x(n)') ;
    grid on
    subplot(3,1,2); stem(nh1, h1); title('h1 sequence');
    xlabel('n'); ylabel('h1(n)');
    grid on;
    subplot(3,1,3); stem(ny1, y1); title('y1=x1*h1 sequence');
    xlabel('n'); ylabel('y1(n)');
    grid on;
    
    
    figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
    set(gcf,'Color',[1,1,1])                  % 改变坐标外围背景颜色
    
    subplot(3,1,1); stem(nx2, x2); title('x2 sequence');
    xlabel('n'); ylabel('x2(n)') ;
    grid on
    subplot(3,1,2); stem(nh2, h2); title('h2 sequence');
    xlabel('n'); ylabel('h2(n)');
    grid on;
    subplot(3,1,3); stem(ny2, y2); title('y2=x2*h2 sequence');
    xlabel('n'); ylabel('y2(n)');
    grid on;
    
    
    figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
    set(gcf,'Color',[1,1,1])                  % 改变坐标外围背景颜色
    
    subplot(3,1,1); stem(nx3, x3); title('x3 sequence');
    xlabel('n'); ylabel('x3(n)') ;
    grid on
    subplot(3,1,2); stem(nh3, h3); title('h3 sequence');
    xlabel('n'); ylabel('h3(n)');
    grid on;
    subplot(3,1,3); stem(ny3, y3); title('y3=x3*h3 sequence');
    xlabel('n'); ylabel('y3(n)');
    grid on;
    
    figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
    set(gcf,'Color',[1,1,1])                  % 改变坐标外围背景颜色
    
    subplot(3,1,1); stem(nx4, x4); title('x4 sequence');
    xlabel('n'); ylabel('x4(n)') ;
    grid on
    subplot(3,1,2); stem(nh4, h4); title('h4 sequence');
    xlabel('n'); ylabel('h4(n)');
    grid on;
    subplot(3,1,3); stem(ny4, y4); title('y4=x4*h4 sequence');
    xlabel('n'); ylabel('y4(n)');
    grid on;
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    浅析影响一个网站的因素
    23种常用设计模式的UML类图
    各版本IE兼容问题,IE6,IE7,IE8,IE9,IE10,IE11
    47种常见的浏览器兼容性问题大汇总
    5个Sublime Text 的插件推荐
    网页设计师神器,快速生成网站配色、字型等风格的工具——Stylify Me
    免费的高分辨率图库——re:splashed 可用做网页背景、设计或桌面壁纸
    MySQL(18):Select- subquery子查询
    MySQL(17):Select-union(联合查询)使用注意事项
    MySQL(16):Select-union(联合查询)
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/8007391.html
Copyright © 2011-2022 走看看