%
% file:      	complex_view_1.m, (c) Matthew Roughan, Sun Aug 22 2004
%
N = 32;
x = (0:N)/N;
f1 = 3.4;
y1 = sin(2*pi*f1*x);
z1 = abs(fft(y1)).^2;

figure(1)
subplot(2,1,1);
hold off
plot([x; x], [zeros(size(y1)); y1],'b', 'linewidth', 3);
hold on
plot(x, y1, 'bo', 'linewidth', 4);
set(gca, 'linewidth', 3, 'fontsize', 18);
set(gca, 'ylim', [-1.2 1.2], 'xlim', [0 max(x)], 'xtick', [], 'ytick', []);
title('signal');

subplot(2,1,2);
hold off
plot([0:N-1; 0:N-1], [zeros(1, N); z1(1:N)], 'b', 'linewidth', 4);
hold on
plot(0:N-1, z1(1:N), 'bo', 'linewidth', 3);
set(gca, 'linewidth', 3, 'fontsize', 18, 'xlim', [0 N], 'ytick', []);
xlabel('frequency');
title('power spectrum');

set(gcf, 'PaperUnits', 'centimeters', 'PaperOrientation', 'portrait');
print('-depsc', 'Plots/complex_view.eps');
