zoukankan      html  css  js  c++  java
  • DSP using MATLAB示例Example3.18

    代码:

    % Analog Signal
    Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t));
    
    % Continuous-time Fourier Transform
    Wmax = 2*pi*2000; 
    K = 500; k = 0:1:K;                             % index array k for frequencies
    W = k*Wmax/K;                                   % freqency between 0 and +pi, [0,pi] axis divided into 501 points.
    Xa = xa * exp(-j*t'*W) * Dt; 
    
    magXa  = abs(Xa);  angXa  = angle(Xa);  realXa  = real(Xa);  imagXa  = imag(Xa);
    %% --------------------------------------------------------------------
    %%              START Xa's  mag ang real imag
    %% --------------------------------------------------------------------
    figure('NumberTitle', 'off', 'Name', 'Example3.18 Xa its mag ang real imag');
    set(gcf,'Color','white'); 
    subplot(2,2,1); plot(W/pi,magXa); grid on;  %axis([0,1,0,1.5]); 
    title('Magnitude Response');
    xlabel('frequency in pi units'); ylabel('Magnitude  |Xa|'); 
    subplot(2,2,3); plot(W/pi, angXa/pi); grid on;  axis([-1,1,-1,1]);
    title('Phase Response');
    xlabel('frequency in pi units'); ylabel('Radians/pi');
    
    subplot('2,2,2'); plot(W/pi, realXa); grid on;
    title('Real Part');
    xlabel('frequency in pi units'); ylabel('Real');
    subplot('2,2,4'); plot(W/pi, imagXa); grid on;
    title('Imaginary Part');
    xlabel('frequency in pi units'); ylabel('Imaginary');
    %% -------------------------------------------------------------------
    %%             END Xa's  mag ang real imag
    %% -------------------------------------------------------------------
    
    
    
    Xa = real(Xa);
    
    W = [-fliplr(W), W(2:501)];                     % Omega from -Wmax to Wmax
    Xa = [fliplr(Xa), Xa(2:501)];                   % Xa over -Wmax to Wmax interval
    
    %% --------------------------------------------------------------------
    %%              
    %% --------------------------------------------------------------------
    figure('NumberTitle', 'off', 'Name', 'DSP MATLAB Example3.18');
    set(gcf,'Color','white'); 
    subplot(2,1,1); plot(t*1000,xa); grid on;  %axis([0,1,0,1.5]); 
    title('Analog Signal');
    xlabel('t in msec units.'); ylabel('xa(t)'); 
    subplot(2,1,2); plot(W/(2*pi*1000), Xa*1000); grid on; % axis([-1,1,-1,1]);
    title('Continuous-time Fourier Transform');
    xlabel('frequency in KHz'); ylabel('Xa(jW)*1000');
    
    %% -------------------------------------------------------------------
    %%           
    %% -------------------------------------------------------------------
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    Cookie存储在哪里
    save the transient instance before flushing错误解决办法
    hibernate中简单的增删改查
    hibernate中get和load的区别
    使用Linux命令修改数据库密码
    配置solrcloud
    如何确定Redis集群中各个节点的主从关系
    解决Eclipse Debug 断点调试的source not found问题
    .NET框架
    ORM框架
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6084184.html
Copyright © 2011-2022 走看看