# prbs

Pseudorandom binary sequence

## Syntax

``p = prbs(O,N)``
``[PRBS,seed] = prbs(O,N)``
``[PRBS,seed] = prbs(O,N,seed)``

## Description

example

````p = prbs(O,N)` calculates a pseudorandom binary sequence `P` of order `O` and length `N`.```
````[PRBS,seed] = prbs(O,N)` calculates a pseudorandom binary sequence and the seed needed to continue the sequence.```
````[PRBS,seed] = prbs(O,N,seed)` calculates a pseudorandom binary sequence and the seed needed to continue the sequence using the `seed` value.```

## Examples

collapse all

Create a vector using a pseudorandom binary sequence (PRBS) pattern of the order 4.

```O = 4; N = 2^O-1; pattern1 = prbs(O,N);```

Create another vector, this time using a PRBS pattern of order 4 one bit at a time.

```pattern2 = zeros(1,N); [pattern2(1),seed] = prbs(O,1); for ii = 2:N [pattern2(ii),seed] = prbs(O,1,seed); end```

Verify that both patterns are the same.

`disp(isequal(pattern1,pattern2))`
``` 1 ```

## Input Arguments

collapse all

Order of the pseudorandom binary sequence pattern, specified as a positive integer scalar.

Data Types: `double`

Length of the pseudorandom binary sequence pattern, specified as a positive integer scalar.

Data Types: `double`

## Output Arguments

collapse all

Pseudorandom binary sequence pattern of order `O` and length `N`, returned as a vector.

Data Types: `double`

Seed value of the pseudorandom binary sequence pattern, returned as a vector. `seed` is used in subsequent calls to continue the PRBS pattern.

Data Types: `double`

## Version History

Introduced in R2020a