# convintrlv

Permute symbols using shift registers

## Syntax

```intrlved = convintrlv(data,nrows,slope) [intrlved,state] = convintrlv(data,nrows,slope) [intrlved,state] = convintrlv(data,nrows,slope,init_state) ```

## Description

`intrlved = convintrlv(data,nrows,slope)` permutes the elements in `data` by using a set of `nrows` internal shift registers. The delay value of the kth shift register is `(k-1)*slope`, where k = 1, 2, 3,... `nrows`. Before the function begins to process data, it initializes all shift registers with zeros. If `data` is a matrix with multiple rows and columns, the function processes the columns independently.

`[intrlved,state] = convintrlv(data,nrows,slope)` returns a structure that holds the final state of the shift registers. `state.value` stores any unshifted symbols. `state.index` is the index of the next register to be shifted.

`[intrlved,state] = convintrlv(data,nrows,slope,init_state)` initializes the shift registers with the symbols contained in `init_state.value` and directs the first input symbol to the shift register referenced by `init_state.index`. The structure `init_state` is typically the `state` output from a previous call to this same function, and is unrelated to the corresponding deinterleaver.

## Examples

The example below shows that `convintrlv` is a special case of the more general function `muxintrlv`. Both functions yield the same numerical results.

```x = randi([0 1],100,1); % Original data nrows = 5; % Use 5 shift registers slope = 3; % Delays are 0, 3, 6, 9, and 12. y = convintrlv(x,nrows,slope); % Interleaving using convintrlv. delay = [0:3:12]; % Another way to express set of delays y1 = muxintrlv(x,delay); % Interleave using muxintrlv. isequal(y,y1)```

The output below shows that `y`, obtained using `convintrlv`, and `y1`, obtained using `muxintrlv`, are the same.

```ans = 1 ```

Another example using this function is in Effect of Delays on Recovery of Convolutionally Interleaved Data Using MATLAB.

The example on the `muxdeintrlv` reference page illustrates how to use the `state` output and `init_state` input with that function; the process is analogous for this function.

## References

 Heegard, Chris, and Stephen B. Wicker, Turbo Coding, Boston, Kluwer Academic Publishers, 1999.