%%This example uses a raw periodogram
%%The R function #spec.pgram can smooth with Daniell filters, whereas
%%Matlab does not have this functionality built-in; consider using, for 
%%example, Welch's method of averaging periodograms (pwelch) for a 
%%consistent estimate of the spectral density.

lfp = load('lfp-ryan.dat');

lfp1 = lfp(1:1000);
periodogram(lfp1)

set(gca, 'FontSize', 22, 'XLim', [0, 0.5], 'XTick', 0:0.1:0.5)
xlabel('Normalized Frequency ($\times\pi\frac{rad}{sample}$)', 'FontSize', 22, 'Interpreter', 'LaTex')
ylabel('Power ($\frac{dB\cdot sample}{rad}$)', 'FontSize', 22, 'Interpreter', 'LaTex')
title('Spectral Density Estimate', 'FontSize', 22)

set(gcf, 'Position', [200, 100, 1000, 800])
set(gca,'OuterPosition',get(gca,'OuterPosition')+[-0.05, 0.05, 0.05, -0.05])