I am trying to plot a spectrogram using Matlab. Basically what I need is to have: -time in the X axis -Velocity in Y axis -Intensity is the current (in pico Ampere)

Basically, I want to create a simliar plot as the one attached here.

Time is an array of 9000 elements Velocity is a matrix of 9000x128 elements Current is a matrix of 9000x1280 elements

I have a thermal velocity which I can also plot which is an array of 9000 elements.

Can anyone give sugggestion on how to plot it? I want to crate similar to the one below:

Spectrogram plot example


1 Answer 1


spectrogram(x, N, N/2, N, fs, ‘yaxis’) is my default one liner.

To get rid of the non-SI time units, I think you need to do [S, F, T] = spectrogram(x, N, N/2, N, fs); pcolor(S, F, 20*log10(abs(S))); cb = colorbar() cb.Label.String = «some unit»; cl = get(gca, ‘CLim’); set(gca, ‘CLim’, cl(2)+[-40 0];

From memory. You might want to check that S is «amplitude» rather than power, and if pcolor takes S and F in this order or backwards. Also consider shading flat (if dataset is dense) or using imagesc() instead of pcolor.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.