我有一个简单的问题,但是由于我没有使用过MATLAB Fourier变换工具,因此需要一些帮助。我有一个从n excel文件获得的图。该图在时域中。该图的时间范围是0到50 ps。我每0.5 fs就有图的y分量的数据。基本上,该图包含每0.5fs打印的100000个数据。现在,我想获得该图的傅立叶变换。我该怎么办?以下是我的excel文件的一种简单格式,其中包括进行时域图所需的数据。

0       116.0080214
0.0005  116.051128
0.001   116.0939229
0.0015  116.1362197
0.002   116.1776665
0.0025  116.2178118
0.003   116.256182
.
.
.
.
50.0    123.000


第一列是以秒为单位的时间。提前非常感谢您的帮助。最好,HRJ

最佳答案

我为解决方案改编了this page

    Fs = 100000/50;               % Sampling frequency (in 1/ps)
    T = 1/Fs;                     % Sample time (in ps)
    L = 100000;                   % Length of signal
    t = (0:L-1)*T;                % Time vector; your first column should replace this

    % Sum of a 50 1/ps sinusoid and a 120 1/ps sinusoid
    % Your second column would replace y
    x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
    y = x + 2*randn(size(t));     % Sinusoids plus noise

    NFFT = 2^nextpow2(L);         % Next power of 2 from length of y
    Y = fft(y,NFFT)/L;
    f = Fs/2*linspace(0,1,NFFT/2+1);

    close all
    subplot(2,1,1)
    % Plot your original signal
    plot(Fs*t(1:100),y(1:100))
    title('Signal Corrupted with Noise')
    xlabel('time (fs)')

    % Plot single-sided amplitude spectrum.
    subplot(2,1,2)
    plot(f,2*abs(Y(1:NFFT/2+1)))
    title('Single-Sided Amplitude Spectrum of y(t)')
    xlabel('Frequency (1/ps)')
    ylabel('|Y(f)|')

关于matlab - 使用MATLAB对任意图进行傅立叶变换和FFT,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31009956/

10-12 00:26
查看更多