% file:      	fft_sin_1.m, (c) Matthew Roughan, Sun Jun 27 2004
x = (0:0.01:1);
f = 10;              % frequency is ten cycles per second
y = sin(2* pi * f * x);

figure(1);
subplot(2,1,1)
hold off
plot(x, y, 'linewidth', 3);
set(gca,'xlim', [0 max(x)]);
set(gca,'linewidth', 3, 'fontsize', 18);
xlabel('time (seconds)');

z = abs(fft(y));
subplot(2,1,2)
hold off
stem(0:(length(z)-3)/2, z(1:end/2).^2, 'linewidth', 3);
set(gca,'linewidth', 3, 'fontsize', 18);
xlabel('frequency (Hz)');

set(gcf, 'PaperUnits', 'centimeters')
set(gcf, 'PaperPosition', [0 0 20 11.5])
print('-depsc', 'Plots/fft_sin_1.eps');
