필터 지우기
필터 지우기

Power scaling with spectrogram

조회 수: 6 (최근 30일)
Peter
Peter 2013년 5월 13일
댓글: star yen 2016년 1월 28일
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