質問

I have taken the FFT in Matlab in this given way.

X=fft(t); % Take Fourier Transform
T=abs(X); % Take real parts of transform
T=T(1:n/2);

I'm interested in finding the centroid frequency of this plot. I understand that the centroid freuency is given as:

enter image description here

Where x(n) represents the weighted frequency value, or magnitude, of bin number n, and f(n) represents the center frequency of that bin.

Now I am tempted to say that f(n) are the values from T in my script, but those are the absolute values of the imaginary and real components of the FFT and so I don't know how to find the x(n) which is supposed to be a weighted frequency.

役に立ちましたか?

解決

You say that f(n) is the centre-frequency of the n-th bin; this is nothing to do with your data. It's simply a function of your sampling frequency:

f(n) = n * fs / N

You can of course, factor this out in your above equation:

centroid = (fs / N) * SUM { n x(n) } / SUM { x(n) }

It sounds like x is what you've called T in your code.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top