我在將頻譜轉換爲時間序列時遇到了一個小問題。我讀過很多文章,我討論了我正在應用正確的程序,但是我沒有得到正確的結果。你能幫忙找到錯誤嗎?來自頻譜的時間序列
我有一個時間序列,如:
當我計算光譜我做的:點 nPoints =長度(時間序列)的 %號碼;
%time interval
dt=time(2)-time(1);
%Fast Fourier transform
p=abs(fft(timeSeries))./(nPoints/2);
%power of positive frequencies
spectrum=p(1:(nPoints/2)).^2;
%frequency
dfFFT=1/tDur;
frequency=(1:nPoints)*dfFFT;
frequency=frequency(1:(nPoints)/2);
%plot spectrum
semilogy(frequency,spectrum); grid on;
xlabel('Frequency [Hz]');
ylabel('Power Spectrum [N*m]^2/[Hz]');
title('SPD load signal');
我獲得:
我覺得頻譜以及計算。但是現在我需要回去,並從該頻譜獲得一個時間序列,我做的:
df=frequency(2)-frequency(1);
ap = sqrt(2.*spectrum*df)';
%random number form -pi to pi
epsilon=-pi + 2*pi*rand(1,length(ap));
%transform to time series
randomSeries=length(time).*real(ifft(pad(ap.*exp(epsilon.*i.*2.*pi),length(time))));
%Add the mean value
randomSeries=randomSeries+mean(timeSeries);
然而,劇情是這樣的:
凡經幅度低一個數量級比原來的系列。 有什麼建議嗎?
我明白你的觀點。但是,你能否舉一個小例子來說明我應該怎麼做。你能用我以前的代碼嗎? – JPV