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.