int n_preiod = 64; //周期
int n_datalen = 512;
double n_pi = 3.141592653589793;
unsigned short *pDatas = new unsigned short[n_datalen];
unsigned short n_A = 2048; //振幅
//生成正弦波
for(int ii=0;ii<n_datalen;ii+=1)
{
pDatas[ii]=(short)(n_A*(1+0.85*qSin(n_pi/2+2*n_pi*ii/n_preiod)));
}
//释放指针
delete [] pDatas;
pDatas = NULL;
Qt正弦波代码
于 2022-03-18 11:19:44 首次发布