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

        代码:

    %% ----------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 4.9 
    
    ');
    
    banner();
    %% ----------------------------------------------------------------------------
    
    
    %% -------------------------------------------------
    %%            1      X(z)
    %% -------------------------------------------------
    
    b1 = [1, -2, 3, -4]; nb1 = [0:3]; a1 = [4, 3, -2, 1]; na1 = [0:3];               %  
    
    [x1, nx1] = conv_m(b1, nb1, a1, na1)
    
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.9.1 X1(z)')
    set(gcf,'Color','white'); 
    stem(nx1, x1);
    title('X1'); grid on;
    
    
    %% -------------------------------------------------
    %%            2      X(z)
    %% -------------------------------------------------
    b2 = [1, -2, 3, 2, 1]; nb2 = [-2:2]; a2 = [1, 0, 0, 0, 0, 0, -1]; na2 = [-3:3];               %  
    
    [x2, nx2] = conv_m(b2, nb2, a2, na2)
    
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.9.2 X2(z)')
    set(gcf,'Color','white'); 
    stem(nx2, x2);
    title('X2'); grid on;
    
    
    %% -------------------------------------------------
    %%            3      X(z)
    %% -------------------------------------------------
    b3 = [1, 1, 1]; nb3 = [0:2];                %  
    
    [x3_1, nx3_1] = conv_m(b3, nb3, b3, nb3);
    [x3, nx3] = conv_m(x3_1, nx3_1, b3, nb3)
    figure('NumberTitle', 'off', 'Name', 'Problem 4.9.3 X3(z)')
    set(gcf,'Color','white'); 
    stem(nx3, x3);
    title('X3'); grid on;
    
    %% -------------------------------------------------
    %%            4      X4(z)=X1(z)X2(z)+X3(z)
    %% -------------------------------------------------
    [x4_1, nx4_1] = conv_m(x1, nx1, x2, nx2);
    [x4, nx4] = sigadd(x4_1, nx4_1, x3, nx3)
    figure('NumberTitle', 'off', 'Name', 'Problem 4.9.4 X4(z)')
    set(gcf,'Color','white'); 
    stem(nx4, x4);
    title('X4'); grid on;
    
    %% -------------------------------------------------
    %%            5      X(z)
    %% -------------------------------------------------
    b5 = [1, 0, -3, 0, 2, 0, 5, 0, -1]; nb5 = [1:9]; 
    
    a5 = [4, 2, 3, 1]; na5 = [-4:-1];               %  
    
    [x5, nx5] = conv_m(b5, nb5, a5, na5)
    figure('NumberTitle', 'off', 'Name', 'Problem 4.9.5 X5(z)')
    set(gcf,'Color','white'); 
    stem(nx5, x5);
    title('X5'); grid on;
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    Flask路由系统
    Flask配置方式
    Flask应用启动流程
    Flask简介及使用
    python调用支付宝支付接口
    python调用腾讯云短信接口
    Celery简介以及Django中使用celery
    django中使用redis
    Redis之缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级
    git操作
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/8445409.html
Copyright © 2011-2022 走看看