Reputation: 1699
Namely, a spectrogram, and another plot.
N = 1000000;
win = 3125;
no = floor(win/2);
nfft = floor(log2(N));
fs = 31250;
data = pm_data.ch4(1:N);
Fr = 20:10:5000;
t = 1/fs:1/fs:N/fs;
spectrogram(data,hann(win),no,Fr,fs,'yaxis');
colorbar;
set(gca,'Yscale','log')
plot(t,ai_data.ch1(1:N))
I tried putting "hold on" before spectrogram, but it didn't work :\
Upvotes: 0
Views: 455
Reputation:
For two plots to be combined, they must have the same axes. So, the 2D curve you'd be plotting with plot
should be put in 3D space by plot3
, as excaza suggested. Here is a simple example: a parabola on a paraboloid. I use zeros for y-coordinate in plot3
, and a thick line with contrasting color to set it aside from the surface.
x = -1:0.1:1;
[X,Y] = meshgrid(x, x);
surf(X, Y, X.^2-Y.^2)
hold on
plot3(x, zeros(size(x)), x.^2, 'k', 'linewidth', 5)
hold off
Upvotes: 3