Spectral centroid after FFT

4 visualizaciones (últimos 30 días)
Fabian Laumen
Fabian Laumen el 13 de Feb. de 2021
Editada: Fabian Laumen el 13 de Feb. de 2021
Hey guys,
I have a question about the spectral centroid in connection with the FFT. I have a dataset with a million values of a signal and I have already isolated the window with my burst in this signal. Over this window I have formed a FFT. Now I would like to form the Spectral centroid over this window. Is this generally possible? I honestly don't understand how I have to use the Spectral centroid feature of Matlab.
Actually my question is why the spectralCentroid feature works over the whole signal (1 million values) but not over my window (just 10,000 values)?
This is my code after i loaded my input dataset
%Select area around peak Signal
Signal1 = transpose(Plate1.Untitled);
[Plate1_maxValue, Plate1_indexOfMax] = max(Signal1);
Plate1_index1 = (Plate1_indexOfMax - 1500)
Plate1_index2 = (Plate1_indexOfMax + 8499);
Plate1_Window = Signal1(Plate1_index1 : Plate1_index2);
%FFT parameters
Int = 0.01; %sec
Fs = 1000000; %frequency of my sensor
T = 1/Fs;
L = Int*Fs; %Lenght of my Window
t = (0:L-1)
f = Fs*(0:(L/2))/L;
%FFT Plate 1
Plate1_Spec = fft(Plate1_Window);
Plate1_P2 = abs(Plate1_Spec/L);
Plate1_P1 = Plate1_P2(1:L/2+1);
Plate1_P1(2:end-1) = 2*Plate1_P1(2:end-1);
%This one here works but i need my window
centroid = spectralCentroid(Plate1.Untitled,Fs);
t_1 = linspace(0,size(Plate1.Untitled,1)/Fs,size(centroid,1));
plot(t_1,centroid)
xlabel('Time (s)')
ylabel('Centroid (Hz)')
%This one here dosent work
B = transpose(Plate1_Window);
centroid_2 = spectralCentroid(B,Fs);
t_2 = linspace(0,size(B,1)/Fs,size(B,1));
plot(t_2,centroid_2)
xlabel('Time (s)')
ylabel('Centroid (Hz)')

Respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by