%
% file:      	cos_wave.m, (c) Matthew Roughan, Sun Aug  1 2004
%
fs = 44100;
T = 5;
x = (1:fs*T)/fs;
f = 110;
y = 1*cos(2*pi*f*x);

figure(10)
plot(x,y, 'linewidth', 3);
set(gca, 'xlim', [0 0.05]);
set(gca, 'linewidth', 3, 'fontsize', 18);
xlabel('time (seconds)');
print('-depsc', 'Plots/cos_110.eps');

z = fft(y);
w = abs(z).^2;
w = fftshift(w);
q = (-length(w)/2+1:length(w)/2)/T;

figure(1)
semilogy(q, w, 'linewidth', 3);
set(gca, 'linewidth', 3, 'fontsize', 18);
set(gca, 'xlim', [0 500]);
xlabel('frequency (kHz)');
print('-depsc', 'Plots/cos_110_fft.eps');

set(gca, 'xlim', [-500 500]);
xlabel('frequency (kHz)');
print('-depsc', 'Plots/cos_110_fft_even.eps');
wavwrite(y, fs, 'Plots/cos_110.wav');

