急!求基于VC的FFT流程图 本人做课题需要,求基于VC的FFT流程图,请大家帮帮忙吧! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 return(FALSE); if(!PowerOf2(ny, &m)) return FALSE; for (i=0;i<nx;i++) { for (j=0;j<ny;j++) { real[j] = c[i*ny+j].real; imag[j] = c[i*ny+j].imag; } FFT(dir,m,real,imag); for (j=0;j<ny;j++) { c[i*ny+j].real = real[j]; c[i*ny+j].imag = imag[j]; } } free(real); free(imag); return(TRUE);}BOOL PowerOf2(int n, int* bit){ if(n <= 0) return FALSE; int temp = n; int count = 0; *bit = 0; for(int i=0; i<sizeof(int)*8; i++) { if(temp&0x00000001) { count++; *bit = i; } temp = temp>>1; } if(count > 1) return FALSE; return TRUE;}/*------------------------------------------------------------------------- This computes an in-place complex-to-complex FFT x and y are the real and imaginary arrays of 2^m points. dir = 1 gives forward transform dir = -1 gives reverse transform Formula: forward N-1 --- 1 \ - j k 2 pi n / N X(n) = --- > x(k) e = forward transform N / n=0..N-1 --- k=0 Formula: reverse N-1 --- \ j k 2 pi n / N X(n) = > x(k) e = forward transform / n=0..N-1 --- k=0--------------------------------------------------------------------------*/int FFT(int dir,int m,double *x,double *y){ long nn,i,i1,j,k,i2,l,l1,l2; double c1,c2,tx,ty,t1,t2,u1,u2,z; /* Calculate the number of points */ nn = 1; for (i=0;i<m;i++) nn *= 2; /* Do the bit reversal */ i2 = nn >> 1; j = 0; for (i=0;i<nn-1;i++) { if (i < j) { tx = x[i]; ty = y[i]; x[i] = x[j]; y[i] = y[j]; x[j] = tx; y[j] = ty; } k = i2; while (k <= j) { j -= k; k >>= 1; } j += k; } /* Compute the FFT */ c1 = -1.0; c2 = 0.0; l2 = 1; for (l=0;l<m;l++) { l1 = l2; l2 <<= 1; u1 = 1.0; u2 = 0.0; for (j=0;j<l1;j++) { for (i=j;i<nn;i+=l2) { i1 = i + l1; t1 = u1 * x[i1] - u2 * y[i1]; t2 = u1 * y[i1] + u2 * x[i1]; x[i1] = x[i] - t1; y[i1] = y[i] - t2; x[i] += t1; y[i] += t2; } z = u1 * c1 - u2 * c2; u2 = u1 * c2 + u2 * c1; u1 = z; } c2 = sqrt((1.0 - c1) / 2.0); if (dir == 1) c2 = -c2; c1 = sqrt((1.0 + c1) / 2.0); } /* Scaling for reverse forward transform */ if (dir == -1) { for (i=0;i<nn;i++) { x[i] /= (double)nn; y[i] /= (double)nn; } } return(TRUE);} 求基于VC的FFT流程图,请大家帮帮忙吧! installshield 如何解决对话框控件闪烁问题 有关定时器的问题,请赐教! spitwnd 窗口调整大小和分割条的关系 初手请教关于使用类似CListControl控件类的注意事项和关键步骤 关于mfc42ud.lib的问题????? 重写CDialogBar时在CREATE事件中加入添加控件代码,能在MAINFRAME中处理这个控件的事件吗(也就是说能捕获这个消息吗)? 在vc当中有没有读写一行文件的函数,在线等待!!! MFC基于对话框编程有问,请大师帮忙,谢谢! 怎么用拨号服务器进行文件传输 基于对话框的程序怎么相应键盘!! 如何实现窗口的放大,拖动变化
return(FALSE); if(!PowerOf2(ny, &m)) return FALSE;
for (i=0;i<nx;i++) {
for (j=0;j<ny;j++) {
real[j] = c[i*ny+j].real;
imag[j] = c[i*ny+j].imag;
}
FFT(dir,m,real,imag);
for (j=0;j<ny;j++) {
c[i*ny+j].real = real[j];
c[i*ny+j].imag = imag[j];
}
}
free(real);
free(imag); return(TRUE);
}BOOL PowerOf2(int n, int* bit)
{
if(n <= 0) return FALSE; int temp = n;
int count = 0;
*bit = 0;
for(int i=0; i<sizeof(int)*8; i++) {
if(temp&0x00000001) {
count++;
*bit = i;
}
temp = temp>>1;
} if(count > 1) return FALSE; return TRUE;
}/*-------------------------------------------------------------------------
This computes an in-place complex-to-complex FFT
x and y are the real and imaginary arrays of 2^m points.
dir = 1 gives forward transform
dir = -1 gives reverse transform Formula: forward
N-1
---
1 \ - j k 2 pi n / N
X(n) = --- > x(k) e = forward transform
N / n=0..N-1
---
k=0 Formula: reverse
N-1
---
\ j k 2 pi n / N
X(n) = > x(k) e = forward transform
/ n=0..N-1
---
k=0
--------------------------------------------------------------------------*/
int FFT(int dir,int m,double *x,double *y)
{
long nn,i,i1,j,k,i2,l,l1,l2;
double c1,c2,tx,ty,t1,t2,u1,u2,z; /* Calculate the number of points */
nn = 1;
for (i=0;i<m;i++)
nn *= 2; /* Do the bit reversal */
i2 = nn >> 1;
j = 0;
for (i=0;i<nn-1;i++) {
if (i < j) {
tx = x[i];
ty = y[i];
x[i] = x[j];
y[i] = y[j];
x[j] = tx;
y[j] = ty;
}
k = i2;
while (k <= j) {
j -= k;
k >>= 1;
}
j += k;
} /* Compute the FFT */
c1 = -1.0;
c2 = 0.0;
l2 = 1;
for (l=0;l<m;l++) {
l1 = l2;
l2 <<= 1;
u1 = 1.0;
u2 = 0.0;
for (j=0;j<l1;j++) {
for (i=j;i<nn;i+=l2) {
i1 = i + l1;
t1 = u1 * x[i1] - u2 * y[i1];
t2 = u1 * y[i1] + u2 * x[i1];
x[i1] = x[i] - t1;
y[i1] = y[i] - t2;
x[i] += t1;
y[i] += t2;
}
z = u1 * c1 - u2 * c2;
u2 = u1 * c2 + u2 * c1;
u1 = z;
}
c2 = sqrt((1.0 - c1) / 2.0);
if (dir == 1)
c2 = -c2;
c1 = sqrt((1.0 + c1) / 2.0);
} /* Scaling for reverse forward transform */
if (dir == -1) {
for (i=0;i<nn;i++) {
x[i] /= (double)nn;
y[i] /= (double)nn;
}
}
return(TRUE);
}