If you do an FFT plot of a simple signal, like:
t = 0:0.01:1 ;
N = max(size(t));
x = 1 + sin( 2*pi*t ) ;
y = abs( fft( x ) ) ;
stem( N*t, y )
I understand that the number in the first bin is "how much DC" there is in the signal.
y(1) %DC
> 101.0000
The number in the second bin should be "how much 1-cycle over the whole signal" there is:
y(2) %1 cycle in the N samples
> 50.6665
But it's not 101! It's about 50.5.
There's another entry at the end of the fft signal, equal in magnitude:
y(101)
> 50.2971
So 50.5 again.
My question is, why is the FFT mirrored like this? Why isn't it just a 101 in y(2)
(which would of course mean, all 101 bins of your signal have a 1 Hz sinusoid in it?)
Would it be accurate to do:
mid = round( N/2 ) ;
% Prepend y(1), then add y(2:middle) with the mirror FLIPPED vector
% from y(middle+1:end)
z = [ y(1), y( 2:mid ) + fliplr( y(mid+1:end) ) ];
stem( z )
I thought now, the mirrored part on the right hand side is added in correctly, giving me the desired "all 101 bins of the FFT contain a 1Hz sinusoid"
>> z(2)
ans =
100.5943
No comments:
Post a Comment