LDPC码的matlab编解码仿真程序

LDPC码的matlab编解码仿真程序,第1张

#include <iostream>

#include <limits>

#define LNODE 20

using namespace std

#include <malloc.h>

#include <conio.h>

typedef char **HuffmanCode

HuffmanCode HuffmanCoding(int n)

{

int i , f , start , j , count = 1

char *cd

HuffmanCode HC

HC = (HuffmanCode)malloc((n+1)*sizeof(char *))

cd = (char *)malloc(n*sizeof(char))

cd[n-1] = '\0'

for(i = 1 i <= n i++)

{

start = n - 1

for(j = 1 j <= count j++){

cd[--start] = '9'

}

HC[i] = (char *)malloc((n-start)*sizeof(char))

strcpy(HC[i],&cd[start])

count++

}

free(cd)

return(HC)

}//HuffmanCoding

int main()

{

int k

int A[LNODE]

HuffmanCode q

q = HuffmanCoding(LNODE)

for(k = 1 k <= LNODE k++)

cout <<*q[k] <<" "

cout <<"OK"

getch()

return 0

}

Matlab2008 以后的版本自带的就有只需要自己设定生成矩阵即可。自己看一下帮助, Example H = dvbs2ldpc(3/5)spy(H)% Visualize the location of nonzero elements in H. henc = fec.ldpcenc(H)hdec = fec.ldpcdec(H)


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/12027075.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存