% demonstrate the Slepian functions (for multitaper spectral analysis)
%
hnp=200; %half of number of points
npts=2*hnp+1;; %number of points
xvals=[-hnp:hnp];
K=5; %number of taper functions to generate
v=dpss(npts,K/2); %the Slepian functions are now along columns
figure;
set(gcf,'Position',[100 200 1100 400]);
subplot(1,2,1);plot(xvals,v,'LineWidth',1);axis tight;
title(sprintf('Slepian functions, K=%1.0f',K));
vft=fft(v,[],1);
subplot(1,2,2);plot(xvals,fftshift(abs(vft)),'LineWidth',1);axis tight;
title(sprintf('FT of Slepian functions, K=%1.0f',K));

