#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)欢迎分享,转载请注明来源:内存溢出
评论列表(0条)