wal_test.c

来自「Walsh Hadamar Transform CDMA2」· C语言 代码 · 共 66 行

C
66
字号
/*
Demonstration of Walsh function generation, fast and slow Walsh transforms

(c)Max
*/

#include <stdio.h>

#include "fwt.h"
#include "wt.h"
#include "walsh.h"


#define WALSH_NUMBER    5   // generate this function
#define POINTS          64  //  number of points




void PrintData(int *x,int n)
{
int i;

for(i=0;i<n;i++)
 {
 if(!(i&0x07)) printf("\n");
 printf(" %d,",x[i]);
 }
}

void main(void)
{
int i;
double dQ;

int x[POINTS],y[POINTS];


dQ=1.0/((double)POINTS);

// Generate Walsh function

for(i=0;i<POINTS;i++) x[i]=2*walsh(WALSH_NUMBER,dQ*i) - 1;

printf("\n\n -- Input array --- ");

PrintData(x,POINTS);

// Slow Walsh Transform

WT(x,y,POINTS);

printf("\n\n -- Slow Walsh Transform --- ");

PrintData(y,POINTS);

// Fast Walsh Transform

FWT(x,POINTS);

printf("\n\n -- Fast Walsh Transform --- ");

PrintData(x,POINTS);

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?