I have a question about power spectral analysis. Lets assume I have 20 data points sampled at 1Hz. I want to know how power spectrum change withing 20s.
If I divide the 20 points into two 10points (first 10s and last 10s), does total signal power of each 10s dataset still add up to the total power of the 20s? I don’t know why or why not.
My own answer is “no” based on the execution of the following code (A not same as B). Also, for example, take a look at power at 0.1Hz. The power from 20s is not equal to the sum of the two 10s power.
I appreciate your reply or input in this matter.
tt =[ 0.0669 0.1241 0.2598 0.2895 0.3188 0.0159 0.0601 0.1406 0.2037 0.2490 0.2297 0.1740 0.1494 0.3431 0.3867 0.0073 0.4541 0.1653 0.0796 0.2819];
f_tt = fft(tt);
power_tt=f_tt .* conj(f_tt); %Square the fft result to get power.
f=1*(0:numel(tt)/2)/numel(tt); %Sampled at 1Hz. This is fraction of sampling frequency.
A= sum(power_tt(1:11));
%Now split 20s into two 10s, and correct for the mean of each 10s dataset.
half1=tt(1:10)mean(tt(1:10));
half2=tt(11:20)mean(tt(11:20));
f_half1=fft(half1);
f_half2=fft(half2);
power_half1=f_half1 .* conj(f_half1);
power_half2=f_half2 .* conj(f_half2);
B = sum(power_half1(1:6))+sum(power_half2(1:6));
figure(1); plot(f, power_tt(1:(numel(tt)/2+1)), '.');
figure(2); plot(half_f, power_half1(1:(numel(power_half1)/2+1)), '.');
figure(3); plot(half_f, power_half2(1:(numel(power_half2)/2+1)), '.');
