MATLAB Answers

Spectrogram function vs. interactive differences

4 views (last 30 days)
Clay Smith
Clay Smith on 4 Nov 2019
Answered: Subhadeep Koley on 7 Nov 2019
I am doing some scripting where I intend to create many spectrograms and save them to image files. First I used the interactive Spectrogram in the Signal Analyzer and identified the settings that I want to use in the script. However I cannot find a combination of settings in the function that gives the same appearance as the interactive tool output. Specifically the interactive spectrogram looks like it may have been smoothed in the frequency direction whereas the scripted spectrogram is much more noisy.
Spect Interactive.PNG Spect Scripted.PNG
The input data are the same in both cases. My scripted spectrogram is:
spectrogram(spectdata,5120,2560,256,256,'MinThreshold',-30,'yaxis');
Interactive settings:
Spect int settings.PNG
I've tried many combinations of parameters but the smooth vs. noisy appearance always remains.
There is no Leakage setting in the function but that is not the difference.
I read the manual page for how the spectrogram is constructed but there is no clue there.
Any suggestions?

  0 Comments

Sign in to comment.

Answers (1)

Subhadeep Koley
Subhadeep Koley on 7 Nov 2019
Hi, in this case you can (Starting from MATLAB R2017b) directly generate the script which creates the spectrogram inside the Signal Analyzer App. Using that generated script you can programmatically create the same spectrogram as generated by the Signal Analyzer App.
A detail instructions can be found here.
Hope this helps!

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by