Trying to understand the single-sided FFT
401 ビュー (過去 30 日間)
古いコメントを表示
For a single-sided FFT, is it correct to multiply the FFT by 2, if so why? Also, I have seen some examples that take the absolute value and sometimes not. Would you take the absolute value in taking a single-sided FFT and then the real and imaginary components as in the following example?
fw = 2*abs(fft(ft,nfft)/length(ft));
real_fw = real(fw);
imag_fw = imag(fw);
where nfft is defined in the standard way following MathWorks's example.
0 件のコメント
回答 (3 件)
Bruno Luong
2022 年 4 月 22 日
編集済み: Bruno Luong
2022 年 4 月 22 日
Multiplication by 2 for single side is just a convention. To me it doesn't have any solid backup. The convention is stated in page 10-11 here:
It's like "oh, we plot half of the spectrum so otherside of the frequency there is the same amplitude, so just multiply the one we keep by 2".
To respect parseval theorem (Energy conservation), I rather multiply by sqrt(2):
facq = 100;
A=randn(1,21);
N=length(A);
dT = 1/facq;
t = (0:N-1)*dT;
df = facq/N;
Energy_time = sum(A.^2)
EfftA = fft(A)/sqrt(N);
Nh = floor(N/2);
Nh1 = Nh + mod(N,2);
% double-side
dfreq = df*(-Nh:Nh1-1);
doubleside_fftA = fftshift(EfftA);
Energy_ds = sum(abs(doubleside_fftA).^2)
% single-side
sfreq = df*(0:Nh);
singleeside_fftA = EfftA(1:Nh+1);
singleside_fftA(2:Nh1) = singleeside_fftA(2:Nh1)*sqrt(2);
Energy_ss = sum(abs(singleside_fftA).^2)
figure
subplot(3,1,1)
plot(t,A);
subplot(3,1,2)
plot(dfreq,abs(doubleside_fftA));
subplot(3,1,3)
plot(sfreq,abs(singleside_fftA));
2 件のコメント
Chunru
2022 年 4 月 22 日
> It's like "oh, we plot half of the spectrum so otherside of the frequency there is the > same amplitude, so just multiply the one we keep by 2".
> To respect parseval theorem (Energy conservation), I rather multiply by sqrt(2):
Indeed, in the document it is mentioned that the factor of 2 is for auto/cross spectrum (which is power not amplitude), and hence power of +ve and -ve frequency can add up.
It's true, in Fourier analysis, that one can add up the power at two freq, but not the amplitude at two freq
RH
2023 年 11 月 28 日
編集済み: RH
2023 年 11 月 28 日
It does have a solid foundation. You can show, by direct computation, that the inverse dft signal is a signal of the form (X(k=0) + X(N/2)(-1)^n) + sum_{k=1}^{N/2-1) 2 abs(X(k))cos(2*\pi * f_k n + phase(X(k)))
This immediately shows why you multiply by the factor two. I can post a detailed computation if you are interested, it is not hard.
Chunru
2022 年 4 月 22 日
Assume X(k) = FFT(x(n)).
Then one estimate of Power Spectrum Density (PSD) of x(n) can be given as P(k) = X(k)^2 / N for general complex signal x(n).
For real signal, X(k)=X*(-k), the PSD vlaues at positive and negative frequency are the same. Very often, we concern only positive frequency, the power sensity of both + and - frequencies are combined so that there is a factor of 2.
Therefore, when we are of interested in PSD of real signal, we use P(k) = 2 * X(k)^2 / N (for +ve freq).
2 件のコメント
Chunru
2022 年 4 月 22 日
It usually make no sense to use 2|X(k)|/M. The P(k) = 2 * X(k)^2 / N is the power spectum density estimation that you may have confused with 2|X(k)|/M.
BTW, I cannot address everything like anyone.
Walter Roberson
2022 年 4 月 22 日
編集済み: Walter Roberson
2022 年 4 月 22 日
For a single-sided FFT, is it correct to multiply the FFT by 2, if so why?
No, it is not.
When you use the analytic fourier transform of a real-valued signal, then the single-sided fourier transform is twice the analytic fourier transform restricted to positive frequencies.
But that is the analytic fourier transform, not the discrete fast fourier transform -- and FFT means "Fast Fourier Transform" not "Fourier Transform".
For the discrete fourier transform, you have to extract the real part of the fft() output before multiplying. https://dsp.stackexchange.com/questions/43366/difference-between-single-sided-and-double-sided-amplitude-spectrum
Would you take the absolute value in taking a single-sided FFT and then the real and imaginary components as in the following example?
No, you would not. abs() is guaranteed not to have any imaginary component afterwards (or, to put it another way, that the imaginary component would be all zero.) There would not be any point in taking the imaginary component of the output of abs()
3 件のコメント
Walter Roberson
2022 年 4 月 22 日
I wrote the wrong thing at that point. It is the positive frequency information that you need to extract, which is the first half of the fft() results (possibly omitting the first entry, as that entry corresponds to frequency 0)
2 * F(2:ceil(end/2))
Chunru
2022 年 4 月 22 日
The analytic signal is complex. Its Fourier transform of it has two sided specrum defined (but the negative part IS 0).
When dealing with spectrum of a real signal. The spectrum magnitude is symetric on +ve and -ve freq. Therefore one sided spectrum can be used to represented the whole spectrum. If one is talking about power spectrum, then conventially we multiply by 2 on the positive freqency so that the total power (integration under the spectrum) accounts both the +ve and -ve freq. This can be handy when one is to find the total power over certain bandwidth (say f1 to f2). The integration of P(f) over f1 to f2 give the signal power over that freq range. This is meaningful because in analysing real signal, we rarely talking about -ve freq.
参考
カテゴリ
Help Center および File Exchange で Fourier Analysis and Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!