Matlab:矩形脉冲的傅立叶变换具有非常高的零频率分量

时间:2014-03-20 13:35:39

标签: matlab fft

我试图得到矩形脉冲的一维傅里叶变换。其他一切看似很好;零频率分量看起来非常高,看起来像一个离散的峰值。

FFT图(链接到jpeg图像): https://drive.google.com/file/d/0B0Ah9soYnrlIYmw0UTJRNGhrWFE/edit?usp=sharing

如果有人能告诉我我做错了什么,我将不胜感激。

我的Matlab代码:

function FFT_1D_Example()

    Tau = 10e-3;    %CEST duration in second    
    NoOfPtsOnPulse = 1000;
    %Time scale for the pulse
    t_Pulse = (0:1:NoOfPtsOnPulse-1)*(Tau/(NoOfPtsOnPulse-1));      % in sec   
    B1Max = 1;          % in tesla; current value = 3 uT 

    %% Simulating the pulse shape      
    %Reactangular pulse
    B1_Array_Rect       = ones(1, length(t_Pulse))*B1Max;
    B1_Array_Rect(1)    = 0.0;
    B1_Array_Rect(end)  = 0.0;
    y = B1_Array_Rect;

    figure(1);  plot(t_Pulse, y);  title('Pulse shape');  xlabel('time (seconds)')

    %% FFT
    [Y, NFFT] = Return_1D_FFT(y);
    % Shift zero-frequency component to center of spectrum
    Y = fftshift(Y)

    % Plot single-sided amplitude spectrum.
    figure(2);  plot(abs(Y)) 
    title('Two-Sided Amplitude Spectrum of y(t)')

end
function [Y, NFFT] = Return_1D_FFT(y)
    L = length(y);
    NFFT = 2^nextpow2(L); % Next power of 2 from length of y
    Y = fft(y,NFFT);
end

1 个答案:

答案 0 :(得分:2)

那是什么样的矩形冲动? -1到1或0到1?我想是后者。

在这种情况下,仅通过查看脉冲,您会看到它的平均值大于0.这反映了所谓的DC分量,即FFT的0值。