DSPRelated.com
Forums

Puzzled about (171 133) convolutional encoder

Started by fl November 6, 2013
Hi,
I am implementing a Viterbi decoder. When I prepare for the test vector with its encoder. I am puzzled about the encoder output is not what I expect.
I use Matlab script:

trellis=poly2trellis(7,[171 133],171);
raw_data = [1; zeros(256*4,1)];         % 1 0 0 0 0 0 0 0 0 ...
code0 = convenc(raw_data, trellis); % Encode a string of ones.

I supposed that code0 will converge to state 0 after travel through some states. 
On the contrary, it is endless fluctuate: 

... 0     0     0     0     0     0     0     0     1     0     0     0     
1   0     0     0     1     0     0     0     0     0     1 ...

I think that there are 7 memory in the encoder and this encoder is not feedback type. Thus, the encoder output will converge to 00 00 00 after states history:

0, 32, 16, 8, 4, 2, 1,


What is wrong with me?


Thanks,
On Wed, 6 Nov 2013 06:54:51 -0800 (PST), fl <rxjwg98@gmail.com> wrote:

>Hi, >I am implementing a Viterbi decoder. When I prepare for the test vector with its encoder. I am puzzled about the encoder output is not what I expect. >I use Matlab script: > >trellis=poly2trellis(7,[171 133],171); >raw_data = [1; zeros(256*4,1)]; % 1 0 0 0 0 0 0 0 0 ... >code0 = convenc(raw_data, trellis); % Encode a string of ones. > >I supposed that code0 will converge to state 0 after travel through some states. >On the contrary, it is endless fluctuate: > >... 0 0 0 0 0 0 0 0 1 0 0 0 >1 0 0 0 1 0 0 0 0 0 1 ... > >I think that there are 7 memory in the encoder and this encoder is not feedback type. Thus, the encoder output will converge to 00 00 00 after states history: > >0, 32, 16, 8, 4, 2, 1,
I don't use those routines so I can't help you there. However, it is not difficult to write code that implements the convolutional encoder manually rather than depend on guessing what you've done wrong that has angered the matlab scripts. That has the added benefit of seeing how it actually works and having direct visibility into the encoder state.
> >What is wrong with me?
That's beyond the scope of this newsgroup. ;)
> > >Thanks,
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Wednesday, November 6, 2013 9:54:51 AM UTC-5, fl wrote:
> Hi, > > I am implementing a Viterbi decoder. When I prepare for the test vector with its encoder. I am puzzled about the encoder output is not what I expect. > > I use Matlab script: > > > > trellis=poly2trellis(7,[171 133],171); > > raw_data = [1; zeros(256*4,1)]; % 1 0 0 0 0 0 0 0 0 ... > > code0 = convenc(raw_data, trellis); % Encode a string of ones. > > > > I supposed that code0 will converge to state 0 after travel through some states. > > On the contrary, it is endless fluctuate: > > > > ... 0 0 0 0 0 0 0 0 1 0 0 0 > > 1 0 0 0 1 0 0 0 0 0 1 ... > > > > I think that there are 7 memory in the encoder and this encoder is not feedback type. Thus, the encoder output will converge to 00 00 00 after states history: > > > > 0, 32, 16, 8, 4, 2, 1, > > > > > > What is wrong with me? > > > > > > Thanks,
Sigh. RTFM. Let me help with the help page. trellis = poly2trellis(ConstraintLength,CodeGenerator) trellis = poly2trellis(ConstraintLength,CodeGenerator,... FeedbackConnection) You defined a trellis that has feedback, so obviously it won't terminate.
On Wed, 06 Nov 2013 15:09:27 +0000, Eric Jacobsen wrote:

> On Wed, 6 Nov 2013 06:54:51 -0800 (PST), fl <rxjwg98@gmail.com> wrote: > >>Hi, >>I am implementing a Viterbi decoder. When I prepare for the test vector >>with its encoder. I am puzzled about the encoder output is not what I >>expect. >>I use Matlab script: >> >>trellis=poly2trellis(7,[171 133],171); >>raw_data = [1; zeros(256*4,1)]; % 1 0 0 0 0 0 0 0 0 ... >>code0 = convenc(raw_data, trellis); % Encode a string of ones. >> >>I supposed that code0 will converge to state 0 after travel through some >>states. >>On the contrary, it is endless fluctuate: >> >>... 0 0 0 0 0 0 0 0 1 0 0 0 >>1 0 0 0 1 0 0 0 0 0 1 ... >> >>I think that there are 7 memory in the encoder and this encoder is not >>feedback type. Thus, the encoder output will converge to 00 00 00 after >>states history: >> >>0, 32, 16, 8, 4, 2, 1, > > I don't use those routines so I can't help you there. However, it is > not difficult to write code that implements the convolutional encoder > manually rather than depend on guessing what you've done wrong that has > angered the matlab scripts. That has the added benefit of seeing how > it actually works and having direct visibility into the encoder state.
It makes it far easier to then go and realize your decoder in a real computer language or HDL, too. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Wed, 06 Nov 2013 13:23:02 -0600, Tim Wescott
<tim@seemywebsite.really> wrote:

>On Wed, 06 Nov 2013 15:09:27 +0000, Eric Jacobsen wrote: > >> On Wed, 6 Nov 2013 06:54:51 -0800 (PST), fl <rxjwg98@gmail.com> wrote: >> >>>Hi, >>>I am implementing a Viterbi decoder. When I prepare for the test vector >>>with its encoder. I am puzzled about the encoder output is not what I >>>expect. >>>I use Matlab script: >>> >>>trellis=poly2trellis(7,[171 133],171); >>>raw_data = [1; zeros(256*4,1)]; % 1 0 0 0 0 0 0 0 0 ... >>>code0 = convenc(raw_data, trellis); % Encode a string of ones. >>> >>>I supposed that code0 will converge to state 0 after travel through some >>>states. >>>On the contrary, it is endless fluctuate: >>> >>>... 0 0 0 0 0 0 0 0 1 0 0 0 >>>1 0 0 0 1 0 0 0 0 0 1 ... >>> >>>I think that there are 7 memory in the encoder and this encoder is not >>>feedback type. Thus, the encoder output will converge to 00 00 00 after >>>states history: >>> >>>0, 32, 16, 8, 4, 2, 1, >> >> I don't use those routines so I can't help you there. However, it is >> not difficult to write code that implements the convolutional encoder >> manually rather than depend on guessing what you've done wrong that has >> angered the matlab scripts. That has the added benefit of seeing how >> it actually works and having direct visibility into the encoder state. > >It makes it far easier to then go and realize your decoder in a real >computer language or HDL, too.
Exactly. Matlab's use of poly2trellis to facilitate encoding and decoding has always seemed a bit convoluted to me.
>-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com >
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
>Exactly. Matlab's use of poly2trellis to facilitate encoding and >decoding has always seemed a bit convoluted to me.
Have you no shame? _____________________________ Posted through www.DSPRelated.com
On Thursday, November 7, 2013 4:13:23 PM UTC-6, David Drumm wrote:
> >Exactly. Matlab's use of poly2trellis to facilitate encoding and > > >decoding has always seemed a bit convoluted to me. > > > > Have you no shame? > > > > _____________________________ > > Posted through www.DSPRelated.com
You are supposed to enjoy these silently, else you spoil Eric's fun too. He is like the cat who ate cheese and then waited at the mousehole with baited breath...
On Thu, 7 Nov 2013 14:27:08 -0800 (PST), dvsarwate
<dvsarwate@yahoo.com> wrote:

>On Thursday, November 7, 2013 4:13:23 PM UTC-6, David Drumm wrote: >> >Exactly. Matlab's use of poly2trellis to facilitate encoding and >> >> >decoding has always seemed a bit convoluted to me. >> >> >> >> Have you no shame?
Of course not. But you did give me a good chuckle.
>> >> >> _____________________________ >> >> Posted through www.DSPRelated.com > >You are supposed to enjoy these silently, else >you spoil Eric's fun too. He is like the cat >who ate cheese and then waited at the mousehole >with baited breath...
Dilip also has no shame. ;) Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com