fs = 1e6;

% number of full cycles in sinusoid
% should not be a factor of fs!
cycles = 67;   

% power of 2 speeeds up analyis 
N = 2^10;           

% signal frequency
fx = fs*cycles/N    

t = linspace(0, (N-1)/fs, N);
y = sin(2*pi*fx*t);
s = 20 * log10(abs(fft(y)/N*2));
s = s(1:N/2);
f = (0:length(s)-1) / N;
s(s>-50)

plot(f, s, 'rx');

xlabel('Frequency  [ f / f_s ]');
ylabel('Amplitude  [ dB ]');
fixfig;
