Plot a line of maximum frequencies over spectrogram
7 views (last 30 days)
Show older comments
I know this has been explored before, and I have been trying things from earlier posts. I plot a spectrogram. Then, for some reason, even though "hold on" is called before I plot the line, the spectrogram is erased and the line plots on a white background. I got it to work just fine using the example in Matlab Docs under the spectrogram section.
{As a side note, and perhaps relevant: I also noticed that changing the parameters of Fs and N had a similar result when Fs and N were almost the same. (The relationship changed for different sized N, but generally speaking, if Fs was above 90% to 99% of N, then the red line (max values at each frequency bin) would not plot at all). }
I have made sure that the z-value for the red line is above the z-values on the spectrogram, and also that the zlimit allows for these values.
if true
%
spectrogram(y,100,80,100:2500,Fs,'yaxis')
view(-77,72)
shading interp
colorbar off
view(2)
[s,f2,t,p] = spectrogram(y,100,80,100:2500,Fs);%t=1.294
[q,nd] = max(10*log10(p));
hold on
plot3(t,nd,q*.2,'r','linewidth',4)
xlim([0 1.294])
ylim([100 2500])
zlim([-100 10])
end
If anybody can help I would sure appreciate it! Thanks, Noah
0 Comments
Answers (0)
See Also
Categories
Find more on Logical 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!