DSPRelated.com
Forums

fft

Started by tio tio December 18, 2003
Dear Members,
I acquired one-dimensional data by sound card of my PC with sample
frequency 22050 Hz and period of observation (duration) 30 s. I want to
apply fft on the data and to plot the spectrum. I would like F to be with
real values, not normalized values. I tried this:
Ys(fft(data));
F=0:0.03:11025;
plot(F,Y)
but I get vectors Y and F with different length. Where is my mistake
and if the vector F is given in right way from me?

Best Regards,
Tio



You have truncated the bin size, 1/30, to 0.03. Since this is the step
size used for creating F, F will have the wrong number of elements. Try
instead:
fs = 22050; %Sample rate, Hz
Ys(fft(data));
Y=Y(1:length(data)/2+1); %For real data, only need the first (N/2)+1
points, assuming N is even
F=[0:length(Y)-1]/(length(Y)-1)*fs/2; %Frequency points

Sincerely,
Glen Ragan
-----Original Message-----
From: tio tio [mailto:]
Sent: Thursday, December 18, 2003 2:32 AM
To:
Subject: [matlab] fft Dear Members,
I acquired one-dimensional data by sound card of my PC with sample
frequency 22050 Hz and period of observation (duration) 30 s. I want to
apply fft on the data and to plot the spectrum. I would like F to be
with
real values, not normalized values. I tried this:
Ys(fft(data));
F=0:0.03:11025;
plot(F,Y)
but I get vectors Y and F with different length. Where is my mistake
and if the vector F is given in right way from me?

Best Regards,
Tio
_____ _____________________________________
Note: If you do a simple "reply" with your email client, only the author
of this message will receive your answer. You need to do a "reply all"
if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/matlab

More DSP-Related Groups: http://www.dsprelated.com/groups.php3
_____

> .