• PUDN用户
    了解作者
  • C/C++
    开发工具
  • 4KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 4
    下载次数
  • 2013-06-12 23:39
    上传日期
SIMULATION OF A BLOCK QPSK MODULATION CODE OF LENGTH 7 WITH TWO LEVELS OF ERROR PROTECTION AWGN CHANNEL MODEL SINGLE-STAGE MAXIMUM-LIKELIHOOD DECODING (VITERBI ALGORITHM)
UEP_QPSK.rar
  • UEP_QPSK.c
    23.2KB
内容介绍
/* file: multi1.c author: Robert H. Morelos-Zaragoza revised: October 5, 1994 =========================================================================== SIMULATION OF A BLOCK QPSK MODULATION CODE OF LENGTH 7 WITH TWO LEVELS OF ERROR PROTECTION AWGN CHANNEL MODEL SINGLE-STAGE MAXIMUM-LIKELIHOOD DECODING (VITERBI ALGORITHM) COPYRIGHT NOTICE: This computer program is free for non-commercial purposes. You may implement this program for any non-commercial application. You may also implement this program for commercial purposes, provided that you obtain my written permission. Any modification of this program is covered by this copyright. Copyright 1994. Robert Morelos-Zaragoza. All rights reserved Portions of this program were written by Dojun Rhee, University of Hawaii, 1990. See also: R.H. Morelos-Zaragoza and S. Lin, ``QPSK Block Modulation Codes for Unequal Error Protection,'' IEEE Transactions on Information Theory, Vol. 41, No. 2, pp. 576-581, March 1995. =========================================================================== For this block modulation code, a trellis diagram is as follows: 0 0 0 0 0 @-----@-----@-----@-----@-----@ / \ / \ / \ / \ / \ / \ / 2\ / 2\ / 2\ / 2\ / 2\ / \ 0/ x x x x x \0 / 2/ \ 2/ \ 2/ \ 2/ \ 2/ \ \ / / \ / \ / \ / \ / \ \ / ----@-----@-----@-----@-----@-----@---- \ / /2 0 0 0 0 0 2\ \ @-| |-@ \ \1 1 1 1 1 1 1/ / \ ----@-----@-----@-----@-----@-----@---- / \ \ / \ / \ / \ / \ / / \ 3\ / 3\ / 3\ / 3\ / 3\ / / 3\ x x x x x /3 \ 3/ \ 3/ \ 3/ \ 3/ \ 3/ \ / \ / \ / \ / \ / \ / \ / @-----@-----@-----@-----@-----@ 1 1 1 1 1 The structure of this diagram is read into the program from a file called 'data1' which shall consist of the following 11 lines: 0 0 0 0 1 0 0 1 2 3 0 7 7 7 7 1 0 0 0 1 1 0 1 2 3 1 1 0 2 3 1 1 1 0 1 1 7 7 7 7 2 0 0 0 1 2 1 0 2 3 2 7 7 7 7 Each row in the file is of the form: +----------------------------------------------------------+ | intime | initial | final | output1[0][0] | output1[0][1] | +----------------------------------------------------------+ intime: Type of section, initial (0), intermediate (1) and final (2) initial: Initial state of a branch final: Final state of a branch output1[0][0]: Branch label of upper subtrellis (coset 0) output1[0][1]: Branch label of lower subtrellis (coset 1) For example, the first row in the file indicates that the initial section has a branch, from the "0" state to the "0" state, with label "0" for the upper subtrellis and label "1" for the lower subtrellis. To indicate the end of a section, the program checks whether the initial state (second entry in a row) is equal to 7 (This number can be changed to suit). */ # include <math.h> # include <stdio.h> # include <limits.h> /* #define MAXRAND 0x7fffffff /* */ #define MAXRAND LONG_MAX /* for random number generation */ #define NUMSIM 5000 /* no. simulations per 200 blocks */ #define DEBUG2 /* For debugging only */ int main() { /* variables to index cosets of subtrellis */ struct out1 { int coset[2][2]; } ; int cosetvalue; /* variables for a trellis section */ struct trellis2 { int time; /* section type index */ int initial_state[5]; /* initial states */ int count; /* number of branches in section */ int final_state[5]; /* final states */ struct out1 outbit1[5]; /* branch labels */ } ; /* array for the trellis diagram */ struct trellis2 trellis3[9]; /* miscelaneous variables */ int test; int ifinal; int j; int i,i1,iii,ii; int jj,kk; int k; int l; int pathnum; /* branch counter in a section */ int intime; /* section type */ int initial; /* initial state */ int final; /* final state */ int output1[2][2]; /* branch labels */ int m; int n; int fflush(); /* variables for surviving paths */ struct surv1 { double surv_metric[2][2]; int surv_ini[2][2]; int surv_out[2][2]; int est[2][2][2]; }; struct sur_final1 { double metric[2]; int ini[2]; int final[2]; int est[2][2]; }; struct surv1 suv1[8]; struct surv1 suv[8]; struct sur_final1 surv_final1[8]; struct sur_final1 surv_final[8]; int suv_count1[2]; int suv_count[2]; int min_state; /* variables for distance metrics */ struct dis1 { double distance[2]; double final; double f[2]; int c12est[3]; }; struct metric1 { struct dis1 branch[5]; }; struct metric1 trellis_metric1[8]; struct metric1 trellis_metric[8]; double final0,final1; /* variables for signal points */ double q[2][4]; /* variables for estimates */ struct est { int in[2]; int out; int coset[8]; int ini[3]; int est[3]; }; struct est x_estimate[201]; struct est x_estimate1[201]; struct est y_estimate[201]; long nn; /* variables for block encoding and signal mapping */ struct data { int first; int second[7]; }; struct data code1[201]; /* variables for transmitted signal */ int x[7]; double rx[201][7]; double ry[201][7]; double pi,amp; /* variables for random numbers */ double u1,u2,randmum; double y1,y2,v1,v2,s,w1,w2,x1,x2; int seed; /* variables for bit error rate computations */ double snr; double error = 0.0, error1 = 0.0, error2 = 0.0; double first_error, second_error; double biterror, biterr1, biterr2; /* trellis data file pointer */ FILE *fp1; /* ======================= READ TRELLIS STRUCTURE ======================== */ seed = 1; printf("Enter amplitude, amp ? "); scanf("%lf", &amp); printf("amp = %lf\n", amp); error = 0; fp1=fopen("data1","r"); for(i=1;i<=3;i++) { fscanf(fp1, "%d %d %d %d %d", &intime,&initial,&final, &output1[0][0],&output1[0][1]); pathnum = 1; /* read trellis diagram data */ do{ trellis3[i].time = intime; trellis3[i].initial_state[pathnum] = initial; trellis3[i].final_state[pathnum] = final; trellis3[i].outbit1[pathnum].coset[0][0] = output1[0][0]; trellis3[i].outbit1[pathnum].coset[0][1] = output1[0][1]; fscanf(fp1, "%d %d %d %d %d", &intime,&initial,&final, &output1[0][0],&output1[0][1]); pathnum++; } while (initial != 7); trellis3[i].count = pathnum - 1; } fclose(fp1); /* construct l
评论
    相关推荐
    • viterbi.rar
      卷积编码,编码速率1/2 QPSK调制 维特比译码
    • viterbi_qpsk.rar
      viterbi simulation K = 7 in qpsk modulation
    • QPSK.rar
      1在数字信号的调制方式中QPSK是最常用的一种卫星数字信号调制方式,它具有较高的频谱利用率、较强的抗干扰性、在电路上实现也较为简单。 2主要包括QPSK的调制解调
    • QPSK.rar
      用matlab软件仿真了从卷积码编码,QPSK调制,AWGN信道,QPSK解调,以及Viterbi译码
    • viterbi.rar
      正交相移键控(Quadrature Phase Shift Keyin,QPSK)是一种数字调制方式。它分为绝对相移和相对相移两种。由于绝对相移方式存在相位模糊问题,所以在实际中主要采用相对移相方式DQPSK
    • 卷积编码和viterbi译码,调制方式为qpsk的matlab程序
      卷积编码和viterbi译码,调制方式为qpsk的matlab程序
    • qpsk.zip
      understanding lte bpsk file
    • qpsk_viterbi_soft.rar
      modulation with vibertisoft in qpsk with bertool
    • qpsk_viterbi.rar
      modulation with viberti in qpsk with bertool
    • viterbi.zip
      基于MATLAB实现viterbi编译码过程