This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

我的fft,在编译时没问题,但是运算不了,怎么会回事



#include "DSP28x_Project.h"    

 #include<stdio.h>

 #include<stdlib.h>

#include "math.h"

#include "float.h"

 

 

 

 

int Num=256 ;

const float pp=3.14159 ;

 

///FFT

typedef struct  {float real,imag;}compx;

compx*s;  

compx EE( compx b1, compx b2)

 {      compx b3 ;   

  b3.real=b1.real*b2.real-b1.imag*b2.imag ;    

b3.imag=b1.real*b2.imag+b1.imag*b2.real ;  

   return(b3);

 }

void FFT( compx*xin,int N)

 {     int f,m,nv2,nm1,i,k,j=1,l ;

      compx v,w,t ;   

  nv2=N/2 ;   

  f=N ;    

 for(m=1;(f=f/2)!=1;m++)  

   {         ;  

   }  

   nm1=N-1 ;

    /*变址运算*/    

for(i=1;i<=nm1;i++)   

  {         if(i<j)     

         {   t=xin[j];       

            xin[j]=xin[i];          

            xin[i]=t ;       

          }

         k=nv2 ;        

   while(k<j)       

    {     j=j-k ;   

          k=k/2 ;  

       }        

    j=j+k ;     }

    {         int le,lei,ip ;     

          float pi ;      

   for(l=1;l<=m;l++)     

    {   le=pow(2,l);             // 这里用的是L而不是1  !!!!       

      lei=le/2 ;            

     pi=3.14159 ;           

     v.real=1.0 ;          

    v.imag=0.0 ;        

     w.real=cos(pi/lei);   

          w.imag=-sin(pi/lei);   

          for(j=1;j<=lei;j++)        

     {             for(i=j;i<=N;i=i+le)            

                   {    ip=i+lei ;       

                       t=EE(xin[ip],v);      

                      xin[ip].real=xin[i].real-t.real ;       

                      xin[ip].imag=xin[i].imag-t.imag ;     

                     xin[i].real=xin[i].real+t.real ;         

                      xin[i].imag=xin[i].imag+t.imag ;   

              }      

           v=EE(v,w);       

         }   

      }  

   }    

 return ; }

 

 

这是什么地方出错了