一个FFT的小程序如下:
void four1(double data[], int nn, int isign)
{
int n, mmax, m, j, istep, i;
double wtemp, wr, wpr, wpi, wi, theta;
double tempr, tempi,temp;
int PI=3.14;
n = nn << 1;
j = 1;
for (i = 1; i < n; i += 2) {
if (j > i) {
tempr = data[j]; data[j] = data; data = tempr;
tempr = data[j+1]; data[j+1] = data[i+1]; data[i+1] = tempr;
}
m = n >> 1;
while (m >= 2 && j > m) {
j -= m;
m >>= 1;
}
j += m;
}
mmax = 2;
while (n > mmax) {
istep = 2*mmax;
theta = 2*PI/(isign*mmax);
wtemp = sin(0.5*theta);
wpr = -2.0*wtemp*wtemp;
wpi = sin(theta);
wr = 1.0;
wi = 0.0;
for (m = 1; m < mmax; m += 2)
{
for (i = m; i <= n; i += istep)
{
j =i + mmax;
tempr = wr*data[j] - wi*data[j+1];
tempi = wr*data[j+1] + wi*data[j];
data[j] = data - tempr;
data[j+1] = data[i+1] - tempi;
data += tempr;
data[i+1] += tempi;
}
wr = (wtemp = wr)* wpr - wi * wpi + wr;
wi = temp + wpr + wtemp * wpi + temp;
}
mmax = istep;
}
}
只要
wr = (wtemp = wr)* wpr - wi * wpi + wr;
wi = temp + wpr + wtemp * wpi + temp;没有注释掉
我的CCS一DEBUG就会
C:\Documents and Settings\Administrator\桌面\CCS.JPG
简单的说就是不能开始,一DEBUG他就直接运行了,给任何地方断点也停不下来,不知道这两句话有什么问题,麻烦大家了! |