%
% Play with the tapers
%

display('We will now play with choice of tapers');
display('Press return to continue');
pause
%
% Declares default values just in case they have been deleted
%
params.Fs=1000; % inverse of the spacing of the grid onw hcih tapers are computed
params.fpass=[0 100]; % frequency range of interest
params.pad=2;
figure;
user_continues='y';
while strcmp(user_continues,'y')
  defaultparams=0;
  TW=input('Give me a time-bandwidth product >= 1 and < 10 ');
  if ~isempty(TW);
     if TW>10; TW=3;display('Time-bandwidth product too high, using default, 3'); end;
     if TW<1; TW=3;display('Time-bandwidth product has to be greater than 1, using default, 3'); end;
  else 
    display('User has not specified time-bandwidth product, using default, 3');
    TW=3;
  end
  params.tapers=[TW 2*TW-1];
  [S,f]=mtspectrumc(data,params);
  plot_vector(S,f,[],[],'y');
  set(gca,'FontName','Times New Roman','Fontsize', 16);
  xlabel('frequency Hz'); ylabel('Spectrum dB');
  title(['LFP spectrum for 1 trial with W=' num2str(params.tapers(1))]);
  position_figure
  user_continues=input('Do you want to continue to play ? Type y for Yes, and n for No ','s');
end