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

    代码:

    %% ----------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 4.8 
    
    ');
    
    banner();
    %% ----------------------------------------------------------------------------
    
    
    %% -----------------------------------------------------
    %%             x3(n)=x1(n)*x2(n)
    %%          sigma(x3)=[sigma(x1)] [sigma(x2)]
    %% -----------------------------------------------------
    num = 10;
    x1 = 0 + (2-0)*rand(1, 2*num+1);
    n1 = [-num:num];
    sum_x1 = sum(x1(:))
    
    x2 = 0 + (2-0)*rand(1, 2*num+1);
    n2 = [-num:num];
    sum_x2 = sum(x2(:))
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.8 Sequence x1 and x2');
    set(gcf,'Color','white'); 
    %hist(x1,x_axis); 
    subplot(2,1,1); stem(n1, x1);
    title('Uniformly Distributed Random Numbers x1(n)');
    xlabel('n'); ylabel('x1(n)'); grid on;
    subplot(2,1,2); stem(n2, x2);
    title('Uniformly Distributed Random Numbers x2(n)');
    xlabel('n'); ylabel('x2(n)'); grid on;
    
    
    [x3, n3] = conv_m(x1, n1, x2, n2);
    sum_x3 = sum(x3(:))
    sum_chk = sum_x1 * sum_x2
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.8 Sequence x3');
    set(gcf,'Color','white'); 
    %hist(x1,x_axis); 
    %subplot(2,1,1); 
    stem(n3, x3);
    title('Sequence x3(n)=x1*x2 ');
    xlabel('n'); ylabel('x3(n)'); grid on;
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    EJB>复合主键(Composite Primary Key)
    EJB>消息驱动beanTopic 消息的发送与接收(Pub/sub 消息传递模型)
    JSF>自订验证器
    EJB>自定义安全域
    EJB>Entity 的生命周期和状态、回调函数
    EJB>安全服务的具体开发
    单片机的中断系统
    JavaScript代码检查工具——JSLintMate
    如何开发一个 N9 上的程序
    NSIS安装制作基础教程
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/8436672.html
Copyright © 2011-2022 走看看