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、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    _bzoj1061 [Noi2008]志愿者招募【最小费用最大流】
    _bzoj2243 [SDOI2011]染色【树链剖分】
    _bzoj1013 [JSOI2008]球形空间产生器sphere【高斯消元】
    _bzoj1002 [FJOI2007]轮状病毒【瞎搞】
    leetcode 273 Integer to English Words
    leetcode 12 Integer to Roman
    leetcode 1071 Greatest Common Divisor of Strings
    lc6 ZigZag Conversion
    lc13 Roman to Integer
    leetcode 171 Excel Sheet Column Number
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6084184.html
Copyright © 2011-2022 走看看