%%  Controlling the smoothing

display('To smooth the spectrum, press return');
pause
%
% Repeat calculation from the previous script
%
ch=6;% trial number
delay_samples=1001:2000; % delay period sample numbers
data=dlfp1t(delay_samples,ch); % data in delay period
params.Fs=1000; % sampling frequency
params.fpass=[0 100]; % frequency range of interest
params.pad=2; % set the pad factor
[S,f]=mtspectrumc(data,params);
figure;
plot_vector(S,f,[],[],'y');
hold on;
%
% Compute spectrum with more tapers
%
params.tapers=[10 19];
[S,f]=mtspectrumc(data,params);
plot_vector(S,f,[],[],'m');
set(gca,'FontName','Times New Roman','Fontsize', 16);
legend(['W=' num2str(3/size(data,1)*params.Fs) 'Hz'],['W=' num2str(params.tapers(1)/size(data,1)*params.Fs) 'Hz']);
title('LFP spectrum for 1 trial with varying bandwidths');
position_figure