spectral centroid in matlab
    조회 수: 14 (최근 30일)
  
       이전 댓글 표시
    
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
답변 (1개)
  jibrahim
    
 2021년 1월 19일
        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
  jibrahim
    
 2021년 1월 19일
				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)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


