When calling functions like pwelch, spectrogram or poctave with no function outputs, MATLAB conveniently provides a plot. That saves me from a lot of code (and potential bugs).
However, the following code (from poctave, I presume something similar occurs elsewhere) makes the plots less intuitive to my eyes, and often cause me to just define the plot from ground up.
[~, scaleFactor, unitsStr] = signal.internal.utilities.getFrequencyEngUnits(CF(end));
elseif (value < 1000)
scaleFactor = 1;
unitsStr = 'Hz';
elseif (value < 1000 * 1000)
scaleFactor = 1 / 1000;
unitsStr = 'kHz';
I prefer the x-axis to read:
[3, 8, 20, 50, 126, 316, 794, 1995, 5012, 12589] [Hz]
[0.003, 0.008, 0.020, 0.050, 0.126, 0.316, 0.794, 1.995, 5.012, 12.589] [kHz]
I see that a similar question was asked here, where it is suggested to modify xticks after the fact, which is somewhat more complicated with the use of cathegorical for xticks:
My request would be for a string option ala:
spectrogram(x, N, N/2, N, 48e3, 'Yaxis', 'UseSIBaseUnits')