Your Ad Here

Wednesday, January 23, 2008

Convolutional Codes

/* C Porgram To Find convolutional Codes or Code Vectors */

#include< stdio.h>
#include< conio.h>

void main()
{
int i,j,k,n,gb,mb,g[10][10],x[10][10],c[10],m[10],t[10];
clrscr();
for(i=0;i< 10;i++)
{
for(j=0;j< 10;j++)
g[i][j]=0;x[i][j]=0;c[i]=0;m[i]=0;t[i]=0;
}
printf("\t\t\t¦ Convolutional Code ¦");
printf("\n\nEnter The No. Of Generator Sequences\t: ");
scanf("%d",&n);
printf("Enter The No. Of Bits In Each Generator Sequence\t: ");
scanf("%d",&gb);
for(i=0;i< n;i++)
{
printf("\n\nEnter The Values Of G%d\t:\n",i);
for(j=0;j< gb;j++)
scanf("%dt",&g[i][j]);
}
printf("\nEnter The No. Of Message Bits\t: ");
scanf("%d",&mb);
printf("Enter The Message Bits\t:\n");
for(i=0;i< mb;i++)
scanf("%d",&c[i]);
for(i=0;i< mb;i++)
{
for(j=0;j< gb;j++)
{
t[j]=m[j];
if(j==0)
m[j]=c[i];
else
m[j]=t[j-1];
}
for(k=0;k< gb;k++)
{
for(j=0;j< gb;j++)
{
if(g[k][j]==1)
x[k][i]=x[k][i]^m[j];
}
}
}
printf("\n\n¦ The Code Vectors Are: ¦\n");
for(i=0;i< mb;i++)
{
printf("¦ \n¦ ");
for(j=0;j< gb;j++)
printf("%d\t",x[j][i]);
}
getch();
}

/*************** OUTPUT ******************
¦ Convolutional Code ¦

Enter The No. Of Generator Sequences : 2
Enter The No. Of Bits In Each Generator Sequence : 3


Enter The Values Of G0 :
1
1
1


Enter The Values Of G1 :
1
0
1


Enter The No. Of Message Bits : 8
Enter The Message Bits :
1
1
0
1
1
0
1
1


¦ The Code Vectors Are: ¦
¦
¦ 1 1 0 ¦
¦ 0 1 0 ¦
¦ 0 1 0 ¦
¦ 0 0 0 ¦
¦ 0 1 0 ¦
¦ 0 1 0 ¦
¦ 0 0 0 ¦
¦ 0 1 0

*/

24 comments:

Anonymous said...

Kindly rectify the program

Anonymous said...

Above code has errors ........

i hope you will correct them ..

Lionel said...

rectifuedxxxxxxxxxxxxxxxxxxxxxx

raikko said...

thanks...working well

Anonymous said...

working well... thanks

Ha Dong Hoon said...

thank u..that's great..
but, can u help me to build convolutional code by C++ and using random binary input?
thank u

Anonymous said...

hey thanks a lot yaar.xellent program..works very well. thank you so much.God bless.
jene

Anonymous said...

I always motivated by you, your views and way of thinking, again, appreciate for this nice post.

- Norman

水唷 said...

Hi,I'm Stephen,come from Taiwan.
Can I ask a question.......
I'm advancing convolutional code...
now I must to write down c++ program of convolutional decoding ,part of Hard decision decode(HDD)..........
but I can't....
so...can you help me??
if you to be willing,I will to appreciate...Thank you!! ^ ^

水唷 said...

Hi,I'm Stephen.come from Taiwan.
Can I ask a questions.......
I'm advancing convolutional code...
now I must to write down c++ program of convolutional decoding ,part of Hard decision decode(HDD)..........
but I can't....
so...can you help me??
if you to be willing,I will to appreciate...Thank you!!

Anonymous said...

its giving rong answer..

Anonymous said...

rong code...problem with logic..

Anonymous said...

can anyone send code for convolutional decoding

Mallu said...

help me to write the out pot to a file......

Mallu said...

Help to write convolution code out put to a file ..

Anonymous said...

Help me to write the convolution out put to a file...

Mallu said...

Help me to write the convolution out put to a file...

Anonymous said...

there is an error in ur convolutional codes.kindly rectified it..

help me plz.

Anonymous said...

plz rectify ur convolutional code

Anonymous said...

Can you put the rectified program.
thks ;)

Anonymous said...

hi, this code has some errors, i fixed them but the output is not like the output that you have on the website. can you fix it please and post that you have fixed it.

Anonymous said...

bad programming

Russia said...

plis decoding!))

Anonymous said...

my output is -858993460 and -858993459. WHy?

Your Ad Here