Power scaling with spectrogram

10 次查看(过去 30 天)
Dear all, I'm processsing a voltage trace (mV) with spectrogram (trace of a couple of minutes, hamming window 1 s, 0.5 s noverlap, 1 s nfft window, 20.000 Hz sampling rate) in order to determine the frequency content which works very well overall. But I do not really understand how I can interprete the power color code. What is the exact scaling of the color code and how can I derive the proper axis notation? I'm really looking forward to your help. All the best, Peter

采纳的回答

Peter
Peter 2013-5-14
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
  2 个评论
Honglei Chen
Honglei Chen 2013-5-14
You are using the last output, so it is power density, i.e., mV^2/Hz.
star yen
star yen 2016-1-28
I key "help spectrogram" in Matlab, and find this statement: % NOTE: This is the same as calling spectrogram with no outputs. [y,f,t,p] = spectrogram(x,256,250,F,1E3,'yaxis'); surf(t,f,10*log10(abs(p)),'EdgeColor','none');
So, 10*log10(abs(p)) is the answer!!(p is power spectral density) But I don't know why p is not equal to s.^2 (I tried several times..)

请先登录,再进行评论。

更多回答(2 个)

Honglei Chen
Honglei Chen 2013-5-13
编辑:Honglei Chen 2013-5-13
Not sure if I understand your question correctly, but you can see the value represented by the color by issuing
>> colorbar
in the command line.
The value is power in dB scale. So if your signal is in volts, then it's in watt.

Peter
Peter 2013-5-13
Well, not exactly. Of course I have a colorbar displaying the range from 0 to 19*10(-4). But what does this mean (µV²/ Hz or something else)? Looking forward to your advice. All the best, Peter
  1 个评论
Honglei Chen
Honglei Chen 2013-5-13
I updated the answer above. It's power in dB scale by default. I'm not sure what 19*10(-4) is, do you have a reproduction step?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by