MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# i am getting 2 streams from convolutional encoder instead of one??

Asked by signal on 31 Jan 2013

i am using convolutional encoder block in SIMULINK with code rate of 1/2 but the problem is this that i am getting 2 streams as an output of encoder instead of one... am i doing any mistake in setting the parameters then what is it??? im using poly2trellis: 5,[23 33] with all other options unchecked... what could be the possible mistake????

## Products

Answer by kjetil87 on 3 Feb 2013
Edited by kjetil87 on 3 Feb 2013

as far as i can see from the "doc poly2trellis" (type it in matlab command window) , it is correct that you get "two output streams". This is because its not really two output streams , the thing is with a 1/2 rate code you can have two different input symbols, either 0 or 1. Each of these inputs will create different outputs depending on what state the trellis is in at the time your symbols enters (and each output will be 2-bit long). Quick example (i will use a smaller trellis to make it simpler) :

```trellis=poly2trellis(3,[7,5]);
trellis.outputs
ans =
```
```       0     3
3     0
2     1
1     2```

Now, what does these outputs mean? The rows represent the state of the convolutional encoder. While the columns represent the input symbol. I.e if the current state of the CC is S=0 , and the input is m=0 , then the output would also be (00)=0 . But if the input was 1 , the output would be (11) = 3, as represented by the first row. You see?

Similar for the next row, here the state is S=1 and if the input is m=0 then the output is (11)=3 , but if the input is m=0 then the output is (00)=0. (same structure goes for trellis.nextStates )

So for your code your output matrix will be 16x2 , because you have 2^(5-1) = 16 states , and there are 2 different input symbols that can create two different outputs from each state.

Hope this helps :)