spectral centroid in matlab

14 visualizaciones (últimos 30 días)
Abhijit Sardar
Abhijit Sardar el 16 de En. de 2021
Comentada: jibrahim el 19 de En. de 2021
i have amplitude data of 1024 microseconds with the sampling the sampling frequency of 1MHz . I am trying to find the spectral cetroid using the function available in the matlab.I am using "spectralCentroid(m,1)" where m is the amplitude data it is giving error"Expected WINDOW to be nonempty" as far as i know f is the sampling freqency in hz i have inputed the sampling frequency as 1000000 Hz but still showing error.Can somebody help me in this?
  2 comentarios
Image Analyst
Image Analyst el 16 de En. de 2021
Make it easy for us to help you. Please attach your signal.
Abhijit Sardar
Abhijit Sardar el 17 de En. de 2021
Hi i am attaching amplitude data for one signal.like this there are 50000 data files. can you tell me how to find the spectral centroid for all the amplitude signal data.

Iniciar sesión para comentar.

Respuestas (1)

jibrahim
jibrahim el 19 de En. de 2021
Hi Abhijit,
spectralCentroid uses a window internally to compute the STFT of the signal. The default window length is 30 milliseconds, which is longer than your input signal, which explains the error.
You should set a shorter window, for example:
c = spectralCentroid(x,1e6,'Window',hann(1024),'OverlapLength',512);
Note that spectralCentroid was designed with audio signals in mind, so it might not be suitable for your needs. Consider using the function meanfreq instead.
  2 comentarios
Abhijit Sardar
Abhijit Sardar el 19 de En. de 2021
Editada: Abhijit Sardar el 19 de En. de 2021
actually i wanted to find the value of frequency centroid of gravity(KHz) so i don't know which function would be suitable to find this parameter.I assumed it is similar to spectralcentroid idk if i am correct. for meanfreq do we need to feed the ouput frequency data after doing FFT on the amplitude data.
jibrahim
jibrahim el 19 de En. de 2021
I think you should use meanfreq. You do not need to do an FFT before calling meanfreq. Just feed it the time-domain signal.
FREQ = meanfreq(X, Fs)

Iniciar sesión para comentar.

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by