Matlab - Power Spectrum

Status
Not open for further replies.

asd09

Newbie level 1
Joined
Apr 10, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
power spectrum matlab

Hi,

I am new to matlab. I would like to ask how can i plot the power spectrum like the one below (see file attached) from a wave file.

I have tried something like below but it didn't turn out what i wanted.

[filename, pathname] = uigetfile;
[data,Fs,nbits] = wavread([pathname filename]);
n = length(data);
t = (0:n-1)/Fs;
p = abs(fft(data));
f = (0:n-1)*(Fs/n);
plot(f,p);
axis([0 500 0 100])


Any info/help is much appreciated.
My apologies if i've posted posted in the wrong section.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…