# Slepian or DPSS window

I am planning to use Slepian or DPSS window in my application where I want central lobe to be concentrated and also have low bandwidth:

http://en.wikipedia.org/wiki/Window_function#DPSS_or_Slepian_window

However, since the generating function is missing and looking at some online resources was not very helpful. So, I am wondering if someone can explain.

OR

If someone has DPSS window code (C++, Matlab) and would be willing to share.

UPDATE (after getting answer from @jojek):

Thanks, @jojek, I was just reading numerical recipe in C (third edition) to understand Slepian window. In their terminology, every Slepian window is defined by two indices jres and kT . Here kT indicates eigen vectors and “jres” some sort of frequency resolution. In their terminology, I am interested in Slepian(2,0) and Slepian(3,0). (Please refer sample page no 664: http://www.nr.com/nr3sample.pdf)

Question. 1: If I understand it right, your solution give me kT = 0 which is what I am also looking for. However, I am still confused about how to choose frequency cut-off.

Question. 2: Numerical recipe in C discusses the origin of this Slepian window and I am interested in knowing where the relevant expression  comes from:

"Copying from Numerical recipe in C" There are two key ideas in multitaper methods, somewhat independent of each other, originating in the work of Slepian. The first idea is that, for a given data length N and choice jres, one can actually solve for the best possible weights w , meaning the ones that make the leakage smallest among all possible choices. The beautiful and nonobvious answer is that the vector of optimal weights is the eigenvector corresponding to the smallest eigenvalue of the symmetric tridiagonal matrix with diagonal elements

¼ [N^2 –(N-1-2j)^2 cos(2 pi jres/ N) ];     j = 0, 1, …. N-1
And off-diagonal element:
-1/2 j (N-j)                                                  --------------------


Regards, Dushyant

If you follow the reference link no. 43 from Wikipedia, then you will end up on this website of Stanford University. They are providing all necessary theory behind DPSS window, together with this MATLAB function (not to mention, that MATLAB already has the dpss function) :

function [w,A,V] = dpssw(M,Wc);

% DPSSW - Compute Digital Prolate Spheroidal Sequence window of
%     length M, having cut-off frequency Wc in (0,pi).

k = (1:M-1);
s = sin(Wc*k)./ k;
c0 = [Wc,s];
A = toeplitz(c0);
[V,evals] = eig(A); % Only need the principal eigenvector
[emax,imax] = max(abs(diag(evals)));
w = V(:,imax);
w = w / max(w);

• Right, as far as I know there's not analytic expression for the DPSS window. – Matt L. Aug 14 '14 at 17:15
• @MattL.: You are right, that's why this function is finding best principal component and basically giving a window function requested by OP. – jojek Aug 14 '14 at 17:20
• @jojek : Thanks for answering. Few points are still not clear to me which I included as update to my orignal question. It would be very helpful to me if you can answer those as well. – Dushyant Kumar Aug 14 '14 at 19:27