⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 random.c

📁 在TI的CCS环境下用C语言编写的lms算法,已经通过测试
💻 C
字号:
/*
	random.c - Zero-mean random noise 
*/  

#define USE_DATA 0

#if USE_DATA  /* Use random data file as input */   
#pragma CODE_SECTION(random, "lms_code"); 
#pragma DATA_SECTION(randdata, "lms_data"); 
#pragma DATA_SECTION(i, "lms_cinit"); 
 
#include "randdata.dat"

static unsigned int i=0;

void random(int *x, unsigned int N)
{       
    unsigned int t;

    for (t=N; t>0; t--) 
    {
       *x++ = randdata[i];
       i++;
       if (i == 10000)
         i=0;                
    }                                       
}

#else   /* Use random function for input */

#include <math.h>

#pragma CODE_SECTION(random, "lms_code"); 
        
void random(int *x, unsigned int N)
{
    unsigned int t;
    for (t=N; t>0; t--)
       *x++ = rand()-0x4000;
}
#endif

⌨️ 快捷键说明

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