Forums

About Frequency and FFT ?

Started by aloha February 20, 2001
Hi!

I can get the correct frequency value from below code:

Fs = 100;
n = 1/Fs:1/Fs:2;
x = 0.8*sin(2*pi*10*n);
z = fft(x);
N = length(z);
z = abs(z(1:N/2+1));
freq = [0:N/2]/N*Fs;
stem(freq,z);grid;zoom on;

but, when I use fft(x,N) -- N=2^k, who can I get the correct frequency value? Thanks!