如同,按钮读取文本数据功能调试完毕,如何将输入的数据绘制成一幅频谱图(数据形式:X Y),在线急等
解决方案 »
- VC关于CFile类写入结构体的问题。
- 任务管理器中当有新进程时,管理器能自动刷新。并不是一直刷新的,他是怎么实现的??
- 【求助】如何让程序自动登陆网易或雅虎邮箱?
- 请问两个进程之间怎么才能相互使用对方的数据
- 菜鸟我要抓狂了!莫名其妙的错误啊,关于doc/view,帮我啊!
- msdn 2002的安装,使用问题!
- 菜鸟问如何动态的改变CTabCtrl每Tab页的头文字.???
- 怎么遍历进程与线程?
- 请问高高手: 我的程序在正常运行很久后才出显如下错误,请帮我考虑会错在什么呢??
- 哪有CJLibrary 6.09啊!!!!!!
- 工程移植问题啊 急!解决马上送分
- 提供给别人DLL做二次开发,要怎么加密??
{ static COMPLEX *w;
static int mstore = 0;
static int n = 1;
COMPLEX u,temp,tm;
COMPLEX *xi,*xip,*xj,*wptr;
int i,j,k,l,le,windex;
double arg,w_real,w_imag,wrecur_real,wrecur_imag,wtemp_real;
if(m != mstore) {
if(mstore != 0) free(w);
mstore = m;
if(m == 0) return;
n = 1 << m;
le = n/2;
w = (COMPLEX *) calloc(le-1,sizeof(COMPLEX));
if(!w)
{ printf("\nUnable to allocate complex W array\n");
exit(1);
}
arg = 4.0*atan(1.0)/le;
wrecur_real = w_real = cos(arg);
wrecur_imag = w_imag = -sin(arg);
xj = w;
for (j = 1 ; j < le ; j++)
{ xj->real = (float)wrecur_real;
xj->imag = (float)wrecur_imag;
xj++;
wtemp_real = wrecur_real*w_real - wrecur_imag*w_imag;
wrecur_imag = wrecur_real*w_imag + wrecur_imag*w_real;
wrecur_real = wtemp_real;
}
}
/* start fft */
le = n;
windex = 1;
for (l = 0 ; l < m ; l++) {
le = le/2;
/* first iteration with no multiplies */
for(i = 0 ; i < n ; i = i + 2*le)
{ xi = x + i;
xip = xi + le;
temp.real = xi->real + xip->real;
temp.imag = xi->imag + xip->imag;
xip->real = xi->real - xip->real;
xip->imag = xi->imag - xip->imag;
*xi = temp;
}
/* remaining iterations use stored w */
wptr = w + windex - 1;
for (j = 1 ; j < le ; j++)
{ u = *wptr;
for (i = j ; i < n ; i = i + 2*le)
{ xi = x + i;
xip = xi + le;
temp.real = xi->real + xip->real;
temp.imag = xi->imag + xip->imag;
tm.real = xi->real - xip->real;
tm.imag = xi->imag - xip->imag;
xip->real = tm.real*u.real - tm.imag*u.imag;
xip->imag = tm.real*u.imag + tm.imag*u.real;
*xi = temp;
}
wptr = wptr + windex;
}
windex = 2*windex;
}
/* rearrange data by bit reversing */
j = 0;
for (i = 1 ; i < (n-1) ; i++)
{
k = n/2;
while(k <= j) {
j = j - k;
k = k/2;
}
j = j + k;
if (i < j)
{ xi = x + i;
xj = x + j;
temp = *xj;
*xj = *xi;
*xi = temp;
}
}
}