Specgram vs Spectrogram
이전 댓글 표시
I am using someone elses code to plot sound input. I am trying to change the specgram function to spectrogram. Their code is written like this: specgram(x,2048,fs); with x=sound input in a 6000000 x 1 vector, fs = sample frequency of 100,000;
I admit I am not sure what 2048 is. This is part of the reason why I am trying to use spectrogram to get a document on the syntax.
If i change the function to spectrogram I get the error:
??? Error using ==> welchparse at 36 The number of samples to overlap must be less than the length of the segments.
I am flying blind here. I can't troubleshoot this on my own as I can not access any information on Mathwork about the syntax of specgram. Anyone have any ideas on appropriate syntax with spectrogram?
댓글 수: 3
Sarvilkumar Pargi
2020년 3월 8일
Anyone else having similar problem make sure if the Signal Processing Toolbox is installed.
Cutie
2021년 6월 21일
I have the signal processing tool box installed, yet I am getting same error. I got code from someone which I am trying to adapt to my data but using spectrogram in place of specgram function is giving same error as above.
Bjorn Gustavsson
2021년 6월 22일
The error-message says that "The number of samples to overlap must be less than the length of the segments". That means that the length of the window input (for the case that you specify an explicit windowing filter) or the window-length input parameter (one can also send in an integer that specifies the length of the segments and use the default windowing filter of that length) has to be larger than the overlap input parameter. If you for example use a segment of 128 samples (or a windowing filter with 128 elements) your overlap has to be smaller than 128. The function (handwavingly) works such that it takes the first 128 samples (in this illustrating case) windows those and calculates the fft of them, then steps forward in the data-array by 128-samples minus the length of the overlap (so if you use 28 samples of overlap it would then start at sample 101 and takes the next 128 samples from that point, and so on till the end of the data sequence. If your overlap is larger than the window-length this would be a stepping-forward through the data-array.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!