# dpsssave

Discrete prolate spheroidal or Slepian sequence database

## Description

`dpsssave(`

creates a database of discrete prolate spheroidal (DPSS) or Slepian sequences and
saves the results in `timeHalfBW`

,`dpsSeq`

,`lambda`

)`dpss.mat`

.

**Note**

If the database `dpss.mat`

exists, subsequent calls to
`dpsssave`

append the Slepian sequences to the
existing file. If the sequences are already in the existing file, then the
function overwrites the old values and issues a warning.

`saveFailureStatus = dpsssave(`

returns a 0 if the database saving operation was successful or a 1 if
unsuccessful.`timeHalfBW`

,`dpsSeq`

,`lambda`

)

## Examples

### Create Database of Slepian Sequences

Construct discrete prolate spheroidal sequences of length 512. Specify a time-half-bandwidth product of 2.5.

seq_length = 512; time_halfbandwidth = 2.5; [dps_seq,lambda] = dpss(seq_length,time_halfbandwidth);

Create a database using the output Slepian sequences and frequency-domain concentration ratios. The function saves the database, `dpss.mat`

, in the current working directory. The output variable, `status`

, is 0 if the function saves the database successfully.

status = dpsssave(time_halfbandwidth,dps_seq,lambda)

status = 0

## Input Arguments

`timeHalfBW`

— Time-half-bandwidth product

positive scalar

Time-half-bandwidth product, specified as a positive scalar. This argument
determines the frequency concentrations of the Slepian sequences in
`dpsSeq`

.

**Data Types: **`single`

| `double`

`dpsSeq`

— Slepian sequences

matrix

Slepian sequences, specified as a matrix. The number of rows in
`dpsSeq`

is equal to the length of the
sequences.

**Data Types: **`single`

| `double`

`lambda`

— Frequency concentration ratios

vector

Frequency concentration ratios of Slepian sequences in
`dpsSeq`

, specified as a vector. The length of
`lambda`

is equal to the number of columns in
`dpsSeq`

.

**Data Types: **`single`

| `double`

## More About

### Structure of DPSS MAT- file Database

The `dpsssave`

function creates and stores a file named
`dpss.mat`

with the DPSS (Slepian sequences) that you generate with the
`dpss`

function.

The `dpsssave`

function assigns a location key (`1`

,
`2`

, …, `n`

) and a name (`E1`

,
`V1`

, `E2`

, `V2`

, ...,
`En`

, `Vn`

) for each Slepian sequence that it
generates and stores it in the `dpss.mat`

file, from the first to the
*n*th sequence.

A `dpss.mat`

file with *n* sequences presents the
following structure:

`E1`

,`E2`

, …,`En`

— Slepian sequences.`V1`

,`V2`

, …,`Vn`

— Frequency-domain energy concentration ratios.`index`

— Database index, a`struct`

array with information of the list of sequence lengths, time-half bandwidth products and locations of the Slepian sequences stored in the DPSS MAT-file database. This structure array comprises of the following fields:`N`

— Vector of sequence lengths. The`dpsssave`

function assigns a single entry in`N`

for each different value of sequence length.`Wlist`

— Structure array of time-half bandwidth products`NW`

and sequence location numbers`key`

. The`dpsssave`

function assigns a sequence location`key`

to each Slepian sequence each time you call it.

`next_key`

— Next-sequence identification key, defined as`next_key=n+1`

where`n`

is the number of Slepian sequences stored in the DPSS MAT-file database.

### Discrete Prolate Spheroidal Sequences

The discrete prolate spheroidal or Slepian sequences derive from the following time-frequency concentration problem. For all finite-energy sequences $$x[n]$$ index limited to some set $$[{N}_{1},{N}_{1}+{N}_{2}]$$, which sequence maximizes this ratio

$$\lambda =\frac{{\displaystyle \underset{-W}{\overset{W}{\int}}|X(f){|}^{2}}df}{{\displaystyle \underset{-Fs/2}{\overset{Fs/2}{\int}}|X(f){|}^{2}df}},$$

where *F _{s}* is the sample
rate and $$\left|W\right|<Fs/2$$. Accordingly, this ratio determines which index-limited sequence
has the largest proportion of its energy in the band
[

*–W*,

*W*]. For index-limited sequences, the ratio must satisfy the inequality $$0<\lambda <1$$. The sequence maximizing the ratio is the first discrete prolate spheroidal or Slepian sequence. The second Slepian sequence maximizes the ratio and is orthogonal to the first Slepian sequence. The third Slepian sequence maximizes the ratio of integrals and is orthogonal to both the first and second Slepian sequences. Continuing in this way, the Slepian sequences form an orthogonal set of bandlimited sequences.

### Time Half Bandwidth Product

The time half bandwidth product is *NW* where *N* is the
length of the sequence and [*–W*,*W*] is the
effective bandwidth of the sequence. In constructing Slepian sequences, you choose
the desired sequence length and bandwidth 2*W*. Both the sequence
length and bandwidth affect how many Slepian sequences have concentration ratios
near one. As a rule, there are 2*NW* – 1 Slepian sequences with
energy concentration ratios approximately equal to one. Beyond
2*NW* – 1 Slepian sequences, the concentration ratios begin to
approach zero. Common choices for the time half bandwidth product are: 2.5, 3, 3.5,
and 4.

You can specify the bandwidth of the Slepian sequences in hertz by defining the time half
bandwidth product as
*NW*/*F _{s}*, where

*F*is the sample rate.

_{s}## Version History

**Introduced before R2006a**

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)