problem with matlab function

Started by designengineer77 July 13, 2007
Hello,
     I am using a matlab function "vitdec" to simulate viterbi decoding in
awgn channel. I noticed a rather weird problem with it. When I increase the
msglength the BER improves(eventually plateaus down), my understanding is
that BEr improves with the traceback length. Attached is the matlab code
and the BERs I observed, traceback length was fixed to 15 for a constraint
length of 3. Is there something wrong i am doing or is there a problem with
vitdec? your help will be greatly appreciated.
Thanks
*****************************************************************************
msglen: 15,       30,    300,     3000,   30000
BER:    2.1e-3, 8.2e-4, 1.5e-4,  9.5e-5,  8.7e-5
****************************************************************************
                             Matlab Code
clear all
snr=4;
k=3;%constraint length
msglen=30000;%msg length            
tblen=15;%traceback length
for snr_idx=1:length(snr)
    p=sqrt(0.5)*(10^(-1*snr(snr_idx)/20));
    no_bit_errors=0;no_bits=0;
    while no_bit_errors<100
        msg = randint(1,msglen); % Random data
        t = poly2trellis(k,[7 5]); % Define trellis.
        [code fstate] = convenc(msg,t,0); % Encode the data.
        noise=p*randn(1,2*msglen);
        inp_bit=2*code-1;
        rec_bit=inp_bit+noise;
        [hrdout]= vitdec( (rec_bit>0), t, tblen, 'trunc', 'hard' );
        no_bit_errors=no_bit_errors+sum(abs(msg-hrdout));
        no_bits=no_bits+length(msg);
    end
BER(snr_idx)=no_bit_errors/no_bits
end



Viterbi is not a block code like Reed-Solomon.
The algorithm will perform as you observed.  If you stick a small
amount of data into the algorithm, the performance (BER) will be
suboptimal.  The algorithm needs data in it to function properly.
If you looked inside the data set, you will see that you have a higher
BER at the start of the data set (versus the end)

On Jul 13, 6:16 am, "designengineer77" <designenginee...@gmail.com>
wrote:
> Hello, > I am using a matlab function "vitdec" to simulate viterbi decoding in > awgn channel. I noticed a rather weird problem with it. When I increase the > msglength the BER improves(eventually plateaus down), my understanding is > that BEr improves with the traceback length. Attached is the matlab code > and the BERs I observed, traceback length was fixed to 15 for a constraint > length of 3. Is there something wrong i am doing or is there a problem with > vitdec? your help will be greatly appreciated. > Thanks > ***************************************************************************** > msglen: 15, 30, 300, 3000, 30000 > BER: 2.1e-3, 8.2e-4, 1.5e-4, 9.5e-5, 8.7e-5 > **************************************************************************** > Matlab Code > clear all > snr=4; > k=3;%constraint length > msglen=30000;%msg length > tblen=15;%traceback length > for snr_idx=1:length(snr) > p=sqrt(0.5)*(10^(-1*snr(snr_idx)/20)); > no_bit_errors=0;no_bits=0; > while no_bit_errors<100 > msg = randint(1,msglen); % Random data > t = poly2trellis(k,[7 5]); % Define trellis. > [code fstate] = convenc(msg,t,0); % Encode the data. > noise=p*randn(1,2*msglen); > inp_bit=2*code-1; > rec_bit=inp_bit+noise; > [hrdout]= vitdec( (rec_bit>0), t, tblen, 'trunc', 'hard' ); > no_bit_errors=no_bit_errors+sum(abs(msg-hrdout)); > no_bits=no_bits+length(msg); > end > BER(snr_idx)=no_bit_errors/no_bits > end
On Jul 18, 6:44 pm, Dan <djthu...@yahoo.com> wrote:
> Viterbi is not a block code like Reed-Solomon. > The algorithm will perform as you observed. If you stick a small > amount of data into the algorithm, the performance (BER) will be > suboptimal.
Yes, but he's feeding 30000 bits at a time; this should be more than enough. -- Oli
On Jul 13, 7:16 am, "designengineer77" <designenginee...@gmail.com>
wrote:
> Hello, > I am using a matlab function "vitdec" to simulate viterbi decoding in > awgn channel. I noticed a rather weird problem with it. When I increase the > msglength the BER improves(eventually plateaus down), my understanding is > that BEr improves with the traceback length. Attached is the matlab code > and the BERs I observed, traceback length was fixed to 15 for a constraint > length of 3. Is there something wrong i am doing or is there a problem with > vitdec? your help will be greatly appreciated. > Thanks
[snip] I'm not going to read your Matlab code, but did you properly terminate your trellis, e.g. put a stream of 0's at the end of the transmission to push your convolutional code to the zero state?
Hello Julius,
  It seems to work now, I did it in trunc mode with enough zeros at
the end of each msg frame.
Thanks for your comment.
Best

On Jul 19, 3:13 pm, julius <juli...@gmail.com> wrote:
> On Jul 13, 7:16 am, "designengineer77" <designenginee...@gmail.com> > wrote: > > > Hello, > > I am using amatlabfunction "vitdec" to simulate viterbi decoding in > > awgn channel. I noticed a rather weird problem with it. When I increase the > > msglength the BER improves(eventually plateaus down), my understanding is > > that BEr improves with the traceback length. Attached is thematlabcode > > and the BERs I observed, traceback length was fixed to 15 for a constraint > > length of 3. Is there something wrong i am doing or is there a problem with > >vitdec? your help will be greatly appreciated. > > Thanks > > [snip] > > I'm not going to read yourMatlabcode, but did you properly terminate > your trellis, e.g. put a stream of 0's at the end of the transmission > to > push your convolutional code to the zero state?