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

    2、代码:

    %% ------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 2.5.2 
    
    ');
    
    time_stamp = datestr(now, 31);
    [wkd1, wkd2] = weekday(today, 'long');
    fprintf('      Now is %20s, and it is %7s  
    
    ', time_stamp, wkd2);
    %% ------------------------------------------------------------------------
    
    n1 = -100; n2 = 100;
    n = [n1:n2];
    x = exp(0.1* j * pi* n);
    %x = cos(0.1 * n);
    
    set(gcf,'Color','white'); 
    stem(n,x); title('exp(0.1jpi n) Sequence');
    xlabel('n'); ylabel('x(n)'); grid on;
    
    figure
    set(gcf,'Color','white'); 
    stem(n,real(x)); title('exp(0.1jpi n) Real Part Sequence');
    xlabel('n'); ylabel('Real[x(n)]'); grid on;
    
    figure
    set(gcf,'Color','white'); 
    stem(n,imag(x)); title('exp(0.1jpi n) Imaginary Part Sequence');
    xlabel('n'); ylabel('Imag[x(n)]'); grid on;
    
    figure
    set(gcf,'Color','white'); 
    stem(n,abs(x)); title('exp(0.1jpi n) Magnitude Sequence');
    xlabel('n'); ylabel('|x(n)|'); grid on;
    
    figure
    set(gcf,'Color','white'); 
    stem(n,(180/pi) * angle(x)); title('exp(0.1jpi n) Phase Sequence');
    xlabel('n'); ylabel('phase[x(n)]'); grid on;
    

      运行结果:

    3、代码:

    %% ------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 2.5.3 
    
    ');
    
    time_stamp = datestr(now, 31);
    [wkd1, wkd2] = weekday(today, 'long');
    fprintf('      Now is %20s, and it is %7s  
    
    ', time_stamp, wkd2);
    %% ------------------------------------------------------------------------
    
    n1 = -20; n2 = 20;
    n = [n1:n2];
    %x = exp(0.1* j * pi* n);
    x = cos(0.1 * n);
    
    set(gcf,'Color','white'); 
    stem(n,x); title('cos(0.1n) Sequence');
    xlabel('n'); ylabel('x(n)'); grid on;
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    c#同类型操作最终得到的结果将是同类型
    RabbitMQ的高级特性(五)延迟队列 lq
    RabbitMQ的高级特性(二)消费端限流 lq
    RabbitMQ的高级特性(一)可靠性传递 lq
    RabbitMQ的高级特性(四)死信队列 lq
    RabbitMQ的高级特性(三)TTL lq
    rabbitmq的常见问题及解决方案 lq
    RabbitMQ集群搭建 lq
    炫酷设计
    【转】全球超酷智能眼镜扫描
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/7954659.html
Copyright © 2011-2022 走看看