| ²é¿´: 561 | »Ø¸´: 4 | |||
zhanglei22Òø³æ (СÓÐÃûÆø)
|
[½»Á÷]
¡¾ÇóÖú¡¿°ïæ¿´¿´³ÌÐò£¡Ð»Ð»ÁË¡¾ÒÑÍê½á¡¿ ÒÑÓÐ2È˲ÎÓë
|
|
ÕâÊÇfftµÄ³ÌÐò ÔËÐÐÖгöÁËÎÊÌâ ²»ÖªÄĵĴíÎó #include #include #include #define N 1000 typedef struct { double real; double img; } complex; void fft(); //¿ìËÙ¸µÀïÒ¶±ä»» void initw(); void change(); void add(complex,complex,complex *); void mul(complex,complex,complex *); void sub(complex,complex,complex *); void output(); complex x(N),*w; int size_x=0; double PI; int main() { int i,method; void fft(); void initw(); void change(); void add(complex,complex,complex *); void mul(complex,complex,complex *); void sub(complex,complex,complex *); void divi(complex,complex,complex *); PI=atan(1)*4; printf("please input the size of x:\n" ;scanf("%d",&size_x); printf("please input the date in x(N):\n" ;for(i=0;i initw(); output(); return 0; } void fft() { int i=0,j=0,k=0,l=0; complex up,down,product; change(); for(i=0;i l=1< for(j=0;j for(k=0;k mul(x[j+k+l],w[size_x*k/2/l],&product); add(x[j+k],product,&up); sub(x[j+k],product,&down); x[j+k]=up; x[j+k+l]=down; } } } } void initw() { int i; w=(complex *)malloc(sizeof(complex)*size_x); for(i=0;i w.real=cos(2*PI/size_x*i); w.img=-1*sin(2*PI/size_x*i); } } void change() { complex temp; unsigned short i=0,j=0,k=0; double t; for(i=0;i k=1;j=0; t=(log(size_x)/log(2)); while((t--)>0) {j=j<<1;j|=(k&1);k=k>>1;} if(j>1) {temp=x;x=x[j];x[j]=temp;} } } void output() { int i; printf("the result are as follows \n" ;for(i=0;i printf("%.4f",x.real); if(x.img>=0.0001) printf("+%.4f\n",x.img); else if(fabs(x.img)<0.0001) printf("\n" ;else printf("%.4f\n",x.img); } } void add(complex a,complex b,complex *c) { c->real=a.real+b.real; c->img=a.img+b.img; } void mul(complex a,complex b,complex *c) { c->real=a.real*b.real-a.img*b.img; c->img=a.real*b.img+a.img*b.real; } void sub(complex a,complex b,complex *c) { c->real=a.real-b.real; c->img=a.img-b.img; } [ Last edited by ÓàÔó³É on 2010-6-2 at 16:23 ] |
» ²ÂÄãϲ»¶
288Çóµ÷¼Á Ò»Ö¾Ô¸¹þ¹¤´ó ²ÄÁÏÓ뻯¹¤
ÒѾÓÐ37È˻ظ´
»úеר˶297
ÒѾÓÐ3È˻ظ´
Çóµ÷¼Á»ú»á
ÒѾÓÐ4È˻ظ´
289-Çóµ÷¼Á
ÒѾÓÐ4È˻ظ´
326·ÖÇóµ÷¼Á
ÒѾÓÐ5È˻ظ´
Ò»Ö¾Ô¸ÉúÎïÓëÒ½Ò©£¬296·Ö£¬Çóµ÷¼Á
ÒѾÓÐ9È˻ظ´
338Çóµ÷¼Á
ÒѾÓÐ5È˻ظ´
Çóµ÷¼Á
ÒѾÓÐ7È˻ظ´
292Çóµ÷¼Á
ÒѾÓÐ16È˻ظ´
320·ÖÈ˹¤ÖÇÄܵ÷¼Á
ÒѾÓÐ3È˻ظ´
» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:
°ÝÍдó¼Ò°ïæ¿´¸ö¼òµ¥³ÌÐò
ÒѾÓÐ11È˻ظ´
Çë°ïæ¿´¿´Íâµ¼ÐŵÄÒâ˼£¬Ð»Ð»£¡
ÒѾÓÐ10È˻ظ´
MCÒ»¸ö¼òµ¥µÄ³ÌÐò£¬ÔËÐв»ÁË£¬ÄÄλ´óÏÀ°ï¿´¿´Ôõô»ØÊ¡£¶àл£¡
ÒѾÓÐ7È˻ظ´
Çë¸÷λ´óÏÀ°ïæ¿´¿´£ºÃº¶Ñ×Ôȼ±ß½çÌõ¼þÉèÖÃÎÊÌ⡣лл£¡
ÒѾÓÐ6È˻ظ´
°ïæ¿´Ò»¶Î³ÌÐò
ÒѾÓÐ3È˻ظ´
ÇóÖúDSCͼ£¬²»»á·ÖÎö°¡£¬´ó¼Ò°ïæ¿´¿´£¬Ð»Ð»£¡£¡
ÒѾÓÐ11È˻ظ´
Ͷ¸åÓдð¸´ÁË£¬Ð©Ðí¼¤¶¯Çë´ó¼Ò°ïæ¿´¿´£¬Ð»Ð»´ó¼Ò£¡£¨ÔÚ13Â¥Ôö¼ÓµÚ¶þ·âÉó¸åÒâ¼û£©
ÒѾÓÐ32È˻ظ´
СµÜÑÐÒ»£¬Å®ÓÑĿǰ±£ÑУ¬ÏëÒ»Æð³öÈ¥£¬´ó¼Ò°ïæ¿´Ï£¬Ð»Ð»¡£¡£¡£
ÒѾÓÐ20È˻ظ´
°ïæ¿´¿´Õâ¸ö³ÌÐò°É
ÒѾÓÐ4È˻ظ´
¡¾ÇóÖú¡¿Öж¾ÁË£¬´ó¼Ò°ïæ¿´¿´¡£Ð»Ð»
ÒѾÓÐ40È˻ظ´
´ó¼Ò°ïæ¿´¿´£¬Ôõô»Ø´ð£¬Ð»Ð»¡£
ÒѾÓÐ11È˻ظ´
¡¾ÇóÖú¡¿°ïæ¸Äдչ¿í³ÌÐò
ÒѾÓÐ11È˻ظ´
magic7004
½ð³æ (Ö°Òµ×÷¼Ò)
- ³ÌÐòÇ¿Ìû: 2
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 444
- ºì»¨: 4
- Ìû×Ó: 3278
- ÔÚÏß: 156.2Сʱ
- ³æºÅ: 482895
- ×¢²á: 2007-12-26
- ÐÔ±ð: GG
- רҵ: »¯Ñ§¹¤³Ì
¡ï
resonant(½ð±Ò+1):¸Ðл²ÎÓë¡£ 2010-06-01 15:04:01
zhanglei22(½ð±Ò+5): 2010-06-02 14:57:45
resonant(½ð±Ò+1):¸Ðл²ÎÓë¡£ 2010-06-01 15:04:01
zhanglei22(½ð±Ò+5): 2010-06-02 14:57:45
|
ÔΣ¬Â¥Ö÷ÖÁÉÙҪ˵һÏÂÊÇʲôÑùµÄ´íÎó°É ÊDZàÒë²»¹ý£¬»¹ÊÇÔËÐÐʱ±ÀÀ££¬»¹ÊǼÆËã½á¹û²»¶Ô£¿ Èç¹ûÊÇǰÁ½¸öµÄ»°£¬Ë³±ã°Ñ´íÎóÐÅÏ¢Ò²Ìù³öÀ´ Èç¹ûÊǺóÒ»¸öµÄ»°£¬¶®FFTµÄÀ´°É£¬ÎÒÖ»¶®C£¬²»¶®¼ÆËã |

2Â¥2010-06-01 14:36:21
zhanglei22
Òø³æ (СÓÐÃûÆø)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 355.6
- Ìû×Ó: 134
- ÔÚÏß: 28·ÖÖÓ
- ³æºÅ: 831417
- ×¢²á: 2009-08-20
3Â¥2010-06-02 14:43:06
zhanglei22
Òø³æ (СÓÐÃûÆø)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 355.6
- Ìû×Ó: 134
- ÔÚÏß: 28·ÖÖÓ
- ³æºÅ: 831417
- ×¢²á: 2009-08-20
|
ompiling... fft.cpp D:\vc\FFT\fft.cpp(22) : error C2440: 'initializing' : cannot convert from 'const int' to 'complex' No constructor could take the source type, or constructor overload resolution was ambiguous D:\vc\FFT\fft.cpp(42) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(42) : error C2228: left of '.real' must have class/struct/union type D:\vc\FFT\fft.cpp(42) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(42) : error C2228: left of '.img' must have class/struct/union type D:\vc\FFT\fft.cpp(60) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(61) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(62) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(63) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(64) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(93) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(93) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(93) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(93) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(103) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(103) : error C2228: left of '.real' must have class/struct/union type D:\vc\FFT\fft.cpp(104) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(104) : error C2228: left of '.img' must have class/struct/union type D:\vc\FFT\fft.cpp(105) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(105) : error C2228: left of '.img' must have class/struct/union type D:\vc\FFT\fft.cpp(106) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(106) : error C2228: left of '.img' must have class/struct/union type D:\vc\FFT\fft.cpp(108) : error C2676: binary '[' : 'complex' does not define this operator or a conversion to a type acceptable to the predefined operator D:\vc\FFT\fft.cpp(108) : error C2228: left of '.img' must have class/struct/union type Ö´ÐÐ cl.exe ʱ³ö´í. FFT.exe - 1 error(s), 0 warning(s) Õâ¸ö´íÎó£¡ |
4Â¥2010-06-02 14:44:12
zhanglei22
Òø³æ (СÓÐÃûÆø)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 355.6
- Ìû×Ó: 134
- ÔÚÏß: 28·ÖÖÓ
- ³æºÅ: 831417
- ×¢²á: 2009-08-20
5Â¥2010-06-02 14:57:36














;
»Ø¸´´ËÂ¥