Thanks - here is my piece of code with a test noise representing my signal in mV. I'm interested in the frequency range between 2 and 40 Hz to be displayes. My question: what unit does the power scaling display, so what can I put on the colorbar as proper scaling unit? How can I deduce the proper scaling unit from the input units? Looking forward to your advice. All the best, Peter
% generate a test signal (supposed in mV)
x=0:1/200:200*pi;
sinus=sin(x)*0.1;
lo=-0.6;
hi=0.2;
noise=lo + (hi-lo) * rand(size(x));
testSignal=sinus+noise;
% display test signal and calculate spectrogram
sampleRate=20000; % sampling rate
t1=20000; % 1s time window
t2=round(0.5*t1);
% calculate spectrogram
[temp,tempF,tempT,tempP]=spectrogram(testSignal,hamming(t1),...
t2,t1,sampleRate,'yaxis');
% find the start point of 2 Hz
tempFstart=find(tempF>=2); tempFstart=tempFstart(1);
% find the end point of 40 Hz
tempFstop=find(tempF<=40); tempFstop=tempFstop(length(tempFstop));
figure
subplot(2,1,1)
plot(testSignal)
axis tight
title('original trace')
ylabel('mV','FontName','Arial','FontSize',8);
subplot(2,1,2)
tempxP=(abs(tempP(tempFstart:tempFstop,:)));
surf(tempT,tempF(tempFstart:tempFstop),(tempxP), ...
'FaceColor','interp','EdgeColor','none'); % pcolor als test
view(0,90)
axis tight
title('spectrogram - power units?')
set(gca, 'GridLineStyle','none','box','off');
ylabel('Hz','FontName','Arial','FontSize',8);
colorbar