# dpsssave

Discrete prolate spheroidal or Slepian sequence database

## Syntax

``dpsssave(time_halfbandwidth,dps_seq,lambda)``
``status = dpsssave(time_halfbandwidth,dps_seq,lambda)``

## Description

example

````dpsssave(time_halfbandwidth,dps_seq,lambda)` creates a database of discrete prolate spheroidal (DPSS) or Slepian sequences and saves the results in `dpss.mat`. NoteIf 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. ```
````status = dpsssave(time_halfbandwidth,dps_seq,lambda)` returns a 0 if the database operation was successful or a 1 if unsuccessful.```

## Examples

collapse all

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 there is success.

`status = dpsssave(time_halfbandwidth,dps_seq,lambda)`
```status = 0 ```

## Input Arguments

collapse all

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

Data Types: `single` | `double`

Slepian sequences, specified as a matrix. The number of rows in `dps_seq` is equal to the length of the sequences.

Data Types: `single` | `double`

Frequency concentration ratios of Slepian sequences in `dps_seq`, specified as a vector. The length of `lambda` is equal to the number of columns in `dps_seq`.

Data Types: `single` | `double`

collapse all

### 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\left[n\right]$ index limited to some set $\left[{N}_{1},{N}_{1}+{N}_{2}\right]$, which sequence maximizes the following ratio:

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

where Fs is the sample rate and $|W|. 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 2W. Both the sequence length and bandwidth affect how many Slepian sequences have concentration ratios near one. As a rule, there are 2NW – 1 Slepian sequences with energy concentration ratios approximately equal to one. Beyond 2NW – 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/Fs, where Fs is the sample rate.

## Version History

Introduced before R2006a