# wrong frequencies using FFT in matlab?

Status
Not open for further replies.

#### Piierre

##### Newbie level 4 I am new to signal processing and are trying to retrieve
the main frequency from a signal sampled with a samp.freq.
of 1kHz. I have been looking at a lot at different FFT:s
and I would like some help to understand them.

To find out how this stuff works I start with creating a
sinussignal in Matlab with the frequency of 1.029Hz

fs=1000;
length=20;
m=(1/fs:1/fs:length);
m=m';
f=1.5029;
signal=sin(2*pi*m*f);

If I perform an FFT on this signal the plot shows me a
frequency of 1.5Hz. What is the reason for this?

I have noticed that if I fix the edges of the signal so the
the sinus wave starts in the amplitude zero and end at
zero, then the FFT plot shows a frequency at 1.5027 which
is closer to what I set the sinussignal to be.
Can anyone explain this and what is the best way to get the
real frequency(1.5029)?

#### mondunno

##### Advanced Member level 4 when u're using fft, use length= powers of 2

where is the fft part of code?

when u tell sin starts at 0 phase and ends with 0 phase, gives correct results? then whatz happening is called fft leakage(for the signal which is not this case).
google out the topic for fft leakage.

mon

Status
Not open for further replies.