The power sum of all frequencies seems that the half amount of the middle frequency power is not added. But the algorithm accords with the Parseval theorem. why?

21 Ansichten (letzte 30 Tage)
when applying the discrete fourier transformation to a signal with even points, the algorithm for the power sum of all frequencies seems that the half amount of the middle frequency power is not added. But the algorithm accords with the Parseval theorem. why?
The example codes in matlab are as following.
x=[1 2 3 4];
N=length(x)
E1=sum(x.^2)/N%total power
cx=fft(x)/N;
E2=sum(abs(cx).^2)%also get total power
%Verifying the total power in frequency domain
Here E1=E2. But I am very puzzled.
In the above Matlab cods, the total points N=4, which is an even number. In the above codes, cx(1) indicates the DC component( the zero frequency). cx(2) indicates the 1 frequency. cx(3) indicates the 2 frequency. cx(4) indicates the 3 frequency, or the -1 frequency according the periodicity.
So cx(2) and cx(4) is a pair, abs(cx(2))^2+ abs(cx(4))^2 is the power to 1 frequency. And abs(cx(3))^2 seems to the half amount of the power to 2 frequency.
But we have known from the matlab verification that abs(cx(1)).^2+ ( abs(cx(3))^2+ abs(cx(4))^2 ) + abs(cx(3))^2=Total power.
I have thought abs(cx(1)).^2+ ( abs(cx(3))^2+ abs(cx(4))^2 ) + 2*abs(cx(3))^2=Total power. But the factor 2 to abs(cx(3))^2 is not needed. Would you like to explain to me why?
Thank you very much!

Akzeptierte Antwort

David Goodmanson
David Goodmanson am 18 Jul. 2019
Bearbeitet: David Goodmanson am 18 Jul. 2019
Hi H^2,
It helps that you are doing this for four frequencies rather than some crazy huge number of them.
x = 1:4;
N = length(x)
E1 = sum(x.^2)/N
cx = fft(x)/N;
E2 = sum(abs(cx).^2)
both results are the same, as you have noted. Total energy is always the sum of the squares of the c's. It just depends on how they are dealt with.
As you have mentioned, c1 is the dc term, c2 is a positive frequency term and c4 is the matching negative frequency term. c3 is the Nyquist term (in general it's c_N/2+1 ), which only shows up for even N and has no matching term.
To obtain the energy, c1 and c_Nyquist are never doubled, although it is done plenty of times by mistake. It's the positive frequency terms, c2 in this case, that tend to get doubled, which can lead to problems.
For the transform of a real signal, the matching positive and negative terms are complex conjugates and have the same absolute value. Then back in the time domain
c exp(2 pi i f t) + c* exp(-2 pi i f t) = 2 |c| cos(2 pi f t + phi)
where phi is the phase angle of c.
So people had the bright idea of displaying the dc term and the doubled positive frequency terms. Doubling |c| gives the amplitude of the associated trig function. Giving up the phases means you can't transform back, but it's all right for plotting purposes.
For total energy, if you square the doubled terms and neglect the negative frequency terms then the net result is 2^2 * (1/2) = 2. But now you are using the amplitude of trig functions, and since <cos^2> = 1/2, including that factor makes the energy come out all right.
Except for the caveat that the Nyquist term is usually neglected in all this, which is incorrect. Most of the time that term is small, but to get the correct total energy it has to be included.
It's far more foolproof to do what you did initially, just sum up the squares of all the |c|'s. And compared to fooling around with doubling certain stuff and not doubling other stuff, sum(|c|^2) is in accord with what the fourier transform is all about.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by