How to get the power spectral density from a Spectrogram in a given frequency range?

18 views (last 30 days)
In the figure I have uploaded for example, is there a function to get the Power spectral density of the signal between 1 - 2 Hz? I think that I need the matrix of numbers used by Matlab to generate the Spectrogram. Is it stored in the variable S considering I used the line: [S,F,T,P] = spectrogram(x1,w,2400,2800,Fs); to generate the spectrogram?

Answers (1)

Youssef  Khmou
Youssef Khmou on 20 Mar 2014
This problem is simple in terms of matrix manipulation, all what you need is the index corresponding to the desired range, let us take an example :
F=rand(100,40);
suppose the frequency is represented by the is the x (40), if i want choose the range 22:25 :
G=F(:,22:25);
  2 Comments
Win
Win on 20 Mar 2014
Ok, thanks for your reply. I've never calculated the energy of a signal before. Do I need to use the function periodogram for it?
Youssef  Khmou
Youssef Khmou on 20 Mar 2014
ok, here is an example using modulated sinusoidal signal :
t = 0:0.001:2;
x = chirp(t,150,1,300);
The number of points for frequency is :
f=0:0.1:150; % example
Code for computing the PSD :
[y,f,t,P]=spectrogram(x,10,6,f,1E3);
figure; surf(t,f,10*log10(abs(P)),'EdgeColor','none');
view(0,90);
xlabel('times s');
ylabel(' frequency Hz');
to choose per example the range 50,100Hz, you need the information of theirs indexes :
x1=500;
x2=1000;
F=P(x1:x2,:);
figure; surf(20*log10(F));

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!