What does "plot(spectrogram(M))" mean?
1 view (last 30 days)
Show older comments
"plot(spectrogram(M(:,1)))" generates a plot whose y-axis values equal those of the x. The result is a set of lines that spiral outwards from a point in the center.
What is the significance of these axes? What does this result say about the data on a broad level?
0 Comments
Answers (1)
Wayne King
on 1 Oct 2013
Edited: Wayne King
on 1 Oct 2013
If the function you are using is the MathWorks' version of spectrogram, then you are plotting a complex-valued function. I don't really see the use case for wanting to do that. I can see wanting to plot the magnitude and phase separately, but that is not what plot(spectrogram(x)) is doing.
First, make sure you are using the MathWorks' spectrogram, enter
>>which spectrogram
and ensure that you get something like:
matlab\toolbox\signal\signal\spectrogram.m
If the above is true, then read the help for spectrogram to see how to plot something meaningful:
t=0:0.001:2; % 2 secs @ 1kHz sample rate
x=chirp(t,0,1,150); % Start @ DC, cross 150Hz at t=1sec
F = 0:.1:100;
[y,f,t,p] = spectrogram(x,256,250,F,1E3,'yaxis');
% NOTE: This is the same as calling spectrogram with no outputs.
surf(t,f,10*log10(abs(p)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time');
ylabel('Frequency (Hz)');
0 Comments
See Also
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!