for k=1:1000
t(k)=k/100;
end
for k = 1:1000
x(k) = cos(2*pi*t(k));
end
m = length(x);
n = pow2(nextpow2(m));
y=fft(x,n);
f=(0:n-1)*(fs/n);
plot(f,y);
Warning: Imaginary parts of
complex X and/or Y arguments
ignored 
for k = 1:1000
x(k) = cos(pi*t(k));
end
y=fft(x,n);
plot(f,y);