亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dif_fft.c

?? DSP信號處理源碼,包括數字信號處理課程中的基本源程序。
?? C
字號:
/**********************************************************************
DIF_FFT.C - DIF FFT 測試程序

fft        基2 DIF FFT 子程序
ifft       基2 DIF IFFT 子程序
draw_image 繪圖子程序
***********************************************************************/

#include    <math.h>
#include    <stdlib.h>
#include    <stdio.h>
#include    <string.h>
#include    <conio.h>
#include    <graphics.h>

/* COMPLEX STRUCTURE */
typedef struct {
    float real, imag;
} COMPLEX;

#define    PI	(4.0*atan(1.0))

 void fft(COMPLEX *,int);
 void ifft(COMPLEX *,int);
 void draw_image(double *x,int m,char *title1,char *title2,
		char *xdis1,char *xdis2,int dis_type);

/********************************************************/
void main(void)
{
  int          i,length,m,j;
  char         title[80],tmp[20];
  double       *amp;
  double       a,tempflt;
  COMPLEX      *samp;

  m=8;
  length = 1<<m;
  amp = (double *) calloc(length+1,sizeof(double));
  samp = (COMPLEX *) calloc(length+1,sizeof(COMPLEX));
	if(!samp) {
	    printf("\nUnable to allocate complex array for fft\n");
	    exit(1);
	}

  /* Input sampling data for processing */

  printf("Waitting for sampling data...");
  for (i = 0; i < length; i++) {
      amp[i] = cos(2.0*PI*(double)i*2.0/length);
      printf("*");
  }
  for (i = 0; i < length; i++) {
     samp[i].real = amp[i]*cos(16.0*PI*(double)i*2.0/length)*amp[i];
     amp[i]= samp[i].real;
     printf("*");
  }

  strcpy(title,"The Sampling Signal Data");
  draw_image(amp,length,title,"The Magnitude","0",itoa(length,tmp,10),0);

/* Find the spectrum of the data */
  printf("Waitting for the FFT calculation...\n");
  fft(samp,m);

/* calculate magnitude */
  tempflt=0;
  for (i = 0 ; i < length ; i++) {
    tempflt  = samp[i].real * samp[i].real + samp[i].imag * samp[i].imag;
    amp[i]   = tempflt;
  }

  strcpy(title,"The Signal Freq Magnitude Result");
  draw_image(amp,length,title,"The Magnitude","0",itoa(length,tmp,10),0);

  printf("Waitting for the IFFT calculation...\n");
  ifft(samp,m);
  strcpy(title,"The IFFT Result");
  for (i=0;i<length;i++) amp[i]=samp[i].real;
  draw_image(amp,length,title,"The Magnitude","0",itoa(length,tmp,10),0);

  free(samp);
  free(amp);
}

/************************************************************************
fft - 基2 DIF FFT 子程序

輸入參數:
	 COMPLEX *x : FFT 輸入和輸出數據區指針;
	      int m : FFT 長度 ( length = 2^m );
輸出參數:
	 輸出數據放在 x 所指的輸入數據區.
	 無輸出參數.

void fft(COMPLEX *x, int m)
*************************************************************************/

void fft(COMPLEX *x,int m)
{
    static COMPLEX *w;           /* used to store the w complex array */
    static int mstore = 0;       /* stores m for future reference */
    static int n = 1;            /* length of fft stored for future */

    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) {

/* free previously allocated storage and set new m */

	if(mstore != 0) free(w);
	mstore = m;
	if(m == 0) return;       /* if m=0 then done */

/* n = 2**m = fft length */

	n = 1 << m;
	le = n/2;

/* allocate the storage for w */

	w = (COMPLEX *) calloc(le-1,sizeof(COMPLEX));
	if(!w) {
	    printf("\nUnable to allocate complex W array\n");
	    exit(1);
	}

/* calculate the w values recursively */

	arg = 4.0*atan(1.0)/le;         /* PI/le calculation */
	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;
	}
    }
}

/************************************************************************
ifft - 基2 DIF IFFT 子程序

輸入參數:
	 COMPLEX *x : IFFT 輸入和輸出數據區指針;
	      int m : IFFT 長度 ( length = 2^m );
輸出參數:
	 輸出數據放在 x 所指的輸入數據區.
	 無輸出參數.

void ifft(COMPLEX *x, int m)
*************************************************************************/

void ifft(x,m)
    COMPLEX *x;
    int m;
{
    static COMPLEX *w;           /* used to store the w complex array */
    static int mstore = 0;       /* stores m for future reference */
    static int n = 1;            /* length of ifft stored for future */

    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;
    float scale;

    if(m != mstore) {

/* free previously allocated storage and set new m */

	if(mstore != 0) free(w);
	mstore = m;
	if(m == 0) return;       /* if m=0 then done */

/* n = 2**m = inverse fft length */

	n = 1 << m;
	le = n/2;

/* allocate the storage for w */

	w = (COMPLEX *) calloc(le-1,sizeof(COMPLEX));
	if(!w) {
	    printf("\nUnable to allocate complex W array\n");
	    exit(1);
	}

/* calculate the w values recursively */

	arg = 4.0*atan(1.0)/le;         /* PI/le calculation */
	wrecur_real = w_real = cos(arg);
	wrecur_imag = w_imag = sin(arg);  /* opposite sign from fft */
	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 inverse 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;
	}
    }

/* scale all results by 1/n */
    scale = (float)(1.0/n);
    for(i = 0 ; i < n ; i++) {
	x->real = scale*x->real;
	x->imag = scale*x->imag;
	x++;
    }
}

/************************************************************************
draw_image - 將輸入數據的幅度畫出圖形。該函數可自動調整顯示的比例, 使圖形
	     充滿整個屏幕。

輸入參數: double *x    -   輸入數據序列的指針;
	  int m        -   輸入數據序列的長度;
	  char *title1 -   顯示圖形的上標題字符串指針;
	  char *xdis1  -   X 坐標左邊顯示標題字符串指針.
	  char *title2 -   顯示圖形的左標題字符串指針.
	  char *xdis2  -   X 坐標右邊顯示標題字符串指針.
	  int dis_type -   顯示類型, 0:連線 1:直線.
輸出參數: 無
*************************************************************************/
void draw_image(double *x,int m,char *title1,char *title2,
		char *xdis1,char *xdis2,int dis_type)
{
 int gdriver=DETECT, gmode,errorcode;
 int i,scx,scy,y0,signa,signb;
 int style, userpat;
 int start_x=40,start_y=40,end_x=10,end_y=60;
 long tlen;
 double ys,xs,ym;
 char dis[40];
 /*initializes the graphics mode */
 initgraph(&gdriver,&gmode,"");
 errorcode=graphresult();
 if (errorcode != grOk) {
    printf("Graphics error: %s\n",grapherrormsg(errorcode));
    printf("Press any key to halt!\n");
    getch();
    exit(1);
 }
 scx=getmaxx();
 scy=getmaxy();
 ym=1.e-90;
 signa=0;
 signb=0;

 for(i=0;i<m;i++) {
    if ((*(x+i)>0)&&(*(x+i)>ym))  ym = *(x+i);
    if ((*(x+i)<0)&&(- *(x+i)>ym))  ym = - *(x+i);
 }
 for(i=0;i<m;i++)  {
    if (*(x+i)>fabs(ym/20)) signa=1;
    if (*(x+i)<-fabs(ym/20)) signb=1;
 }
 if ((signa==1)&&(signb==1)) ys=(double)((scy - start_y - end_y)>>1)/ym;
 else ys=(double)((scy - start_y - end_y)/ym);
 xs=(double)(scx - start_x - end_x)/m;
 y0=((scy - start_y - end_y)>>1)+start_y;

 /* draw the frame */

 setcolor(LIGHTGREEN);
 rectangle(start_x-1,start_y-20,scx-end_x+1,scy-end_y+20);

 setcolor(DARKGRAY);
 /* select the line style */
 style=DASHED_LINE;
 userpat = 1;
 setlinestyle(style, userpat, 1);
 /* a user defined line pattern */
 /* binary: "0000000000000001"  */
 for(i=0;i<=10;i++)
    line(start_x,start_y+(scy-start_y-end_y)*i/10,scx-end_x,start_y+(scy-start_y-end_y)*i/10);
 for(i=0;i<=10;i++)
    line(start_x+(scx-start_x-end_x)*i/10,start_y,start_x+(scx-start_x-end_x)*i/10,scy-end_y);
 setcolor(GREEN);
 style=SOLID_LINE;
 userpat = 1;
 setlinestyle(style, userpat, 1);
 rectangle(start_x,start_y,scx-end_x,scy-end_y);
 setcolor(YELLOW);
 for(i=0;i<=10;i++)
    line(start_x,start_y+(scy-start_y-end_y)*i/10,start_x+5,start_y+(scy-start_y-end_y)*i/10);
 for(i=0;i<=10;i++)
    line(start_x+(scx-start_x-end_x)*i/10,scy-end_y+15,start_x+(scx-start_x-end_x)*i/10,scy-end_y+20);
 settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
 setcolor(YELLOW);
 if((signa==1)&&(signb==0)) {
    strcpy(dis,"0");
    outtextxy(start_x+2,scy-end_y+4,dis);
    gcvt(ym,5,dis);
    outtextxy(start_x+1,start_y-10,dis);
    outtextxy(start_x-10,scy-end_y+24,xdis1);
    outtextxy(scx-2-strlen(xdis2)*8,scy-end_y+24,xdis2);
 }
 else if((signb==1)&&(signa==0)) {
    strcpy(dis,"0");
    outtextxy(start_x+2,start_y-10,dis);
    gcvt(ym,5,dis);
    outtextxy(start_x+2,scy-end_y+4,"-");
    outtextxy(start_x+10,scy-end_y+4,dis);
    outtextxy(start_x-10,scy-end_y+24,xdis1);
    outtextxy(scx-2-strlen(xdis2)*8,scy-end_y+24,xdis2);
 }
 else {
    line(start_x,y0,scx-end_x,y0);
    strcpy(dis,"0");
    outtextxy(start_x-10,y0,dis);
    gcvt(ym,5,dis);
    outtextxy(start_x+2,start_y-10,dis);
    outtextxy(start_x+2,scy-end_y+4,"-");
    outtextxy(start_x+10,scy-end_y+4,dis);
    outtextxy(start_x-10,scy-end_y+24,xdis1);
    outtextxy(scx-2-strlen(xdis2)*8,scy-end_y+24,xdis2);
 }
 strcpy(dis,"Press any key to continue...");
 setcolor(LIGHTRED);
 outtextxy((scx-28*8)>>1,scy-16,dis);

 settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
 tlen=strlen(title1);
 if ((tlen<<4)<scx) {
    setcolor(LIGHTGREEN);
    outtextxy((start_x+scx-end_x-(tlen<<4))>>1,start_y-40,title1);
 }

 settextstyle(DEFAULT_FONT,VERT_DIR,1);
 tlen=strlen(title2);
 if ((tlen<<4)<scy) {
    setcolor(LIGHTGREEN);
    outtextxy(start_x-20,(scy-end_y-(tlen<<3))>>1,title2);
 }
 /*draw the amplitude image*/
 setcolor(WHITE);
 if((signa==1)&&(signb==0)) y0=scy-end_y;
 else if((signb==1)&&(signa==0)) y0=start_y;
 if (dis_type == 0) {
    for(i=0;i<m-1;i++)
      line(xs*i+start_x,y0-*(x+i)*ys,xs*(i+1)+start_x,y0-*(x+i+1)*ys);
 }
 else if (dis_type == 1) {
    for(i=0;i<=m;i++)
      line(xs*i+start_x,y0-*(x+i)*ys,xs*i+start_x,y0);
 }
 getch();
 closegraph();
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费看黄网站| 麻豆91免费看| 日韩激情在线观看| 国产成人免费视频一区| 91同城在线观看| 欧美成人bangbros| 中文字幕一区二区三区不卡在线| 午夜电影网一区| 99国产一区二区三精品乱码| 欧美一区二区三区电影| 伊人开心综合网| 成av人片一区二区| 久久久久久亚洲综合影院红桃 | 久久久.com| 三级亚洲高清视频| 色狠狠色噜噜噜综合网| 日本一区二区三级电影在线观看| 日本免费新一区视频| 91免费观看视频在线| 中文字幕免费不卡| 国产一区二区h| 2021中文字幕一区亚洲| 日本在线不卡视频| 在线成人小视频| 婷婷久久综合九色国产成人| 一本色道久久综合亚洲精品按摩| 中国色在线观看另类| 国产一区二区三区高清播放| 日韩欧美一区中文| 日韩av电影天堂| 欧美一区二区三区免费大片| 亚洲成人免费电影| 欧美三级视频在线| 亚洲r级在线视频| 欧美剧在线免费观看网站| 一区二区欧美精品| 欧美色欧美亚洲另类二区| 一区二区三区 在线观看视频| 日本伦理一区二区| 亚洲国产日韩精品| 欧美精品自拍偷拍动漫精品| 蜜臀av性久久久久av蜜臀妖精| 91麻豆精品国产| 奇米色一区二区| 精品国产91洋老外米糕| 国产精品伊人色| 国产精品女同互慰在线看| 成人黄色软件下载| 亚洲免费伊人电影| 欧美日韩午夜在线视频| 日本系列欧美系列| 久久久综合精品| 91视频你懂的| 日韩电影在线一区| 欧美不卡在线视频| 成人h动漫精品| 日韩二区在线观看| 久久奇米777| 91同城在线观看| 日本特黄久久久高潮| 欧美精品一区视频| 99久久99久久免费精品蜜臀| 亚洲影院在线观看| 精品国产一二三| 色老汉一区二区三区| 蜜桃视频一区二区| 国产精品理论片| 欧美日本视频在线| 国产激情一区二区三区四区| 亚洲视频在线一区| 欧美一卡二卡在线| 不卡视频在线看| 奇米影视在线99精品| 国产精品美女视频| 91精品婷婷国产综合久久竹菊| 国产电影精品久久禁18| 一区二区三区视频在线观看| 欧美成人video| 欧美少妇一区二区| 国产成人免费在线视频| 婷婷开心激情综合| 亚洲视频一区二区在线观看| 日韩一二在线观看| 色综合久久久久综合99| 韩国一区二区视频| 亚洲第一成年网| 国产精品国产自产拍高清av王其 | av亚洲精华国产精华精华| 五月天激情综合| 亚洲私人影院在线观看| wwwwxxxxx欧美| 欧美精品久久天天躁| 99久久婷婷国产综合精品电影| 欧美aaa在线| 亚洲电影欧美电影有声小说| 欧美国产禁国产网站cc| 日韩精品一区二区三区中文不卡| 99国产精品99久久久久久| 国内精品久久久久影院一蜜桃| 亚洲bt欧美bt精品777| 亚洲欧洲日产国产综合网| 久久综合九色欧美综合狠狠| 88在线观看91蜜桃国自产| 色婷婷综合视频在线观看| 成人午夜免费av| 国产大片一区二区| 国模无码大尺度一区二区三区| 日韩国产欧美在线视频| 亚洲高清视频在线| 亚洲一区二区三区四区五区黄| 亚洲欧美自拍偷拍| 中文字幕一区二区三区蜜月 | 制服丝袜成人动漫| 国产视频在线观看一区二区三区| 欧美成人bangbros| 精品女同一区二区| 欧美精品一区二区久久久| 日韩欧美激情在线| 亚洲精品在线观看视频| 精品国产一区二区三区久久久蜜月| 欧美久久一区二区| 欧美美女喷水视频| 欧美一区二区精美| 日韩欧美国产一区二区在线播放| 欧美一区二区三区免费视频| 欧美一区二区三区成人| 欧美一区二区女人| 久久综合999| 亚洲国产精品99久久久久久久久 | 欧美一区二区高清| 精品日韩一区二区三区免费视频| 欧美成人一区二区三区片免费| 精品久久久久久久久久久院品网| 久久亚洲精品小早川怜子| 久久久亚洲午夜电影| 中文字幕av在线一区二区三区| 中文字幕一区二区三区av| 亚洲精品国产一区二区精华液| 亚洲一区二区在线播放相泽| 青草国产精品久久久久久| 精油按摩中文字幕久久| 国产激情视频一区二区在线观看 | 亚洲福利国产精品| 日韩av一区二| 国产精品一区二区男女羞羞无遮挡| 懂色中文一区二区在线播放| 99视频精品全部免费在线| 欧美日韩国产一级二级| 久久综合久久99| 一区二区三区在线视频免费| 另类调教123区| 丁香激情综合国产| 在线免费不卡视频| 精品国产sm最大网站| 亚洲女人的天堂| 青青草视频一区| 色婷婷久久久亚洲一区二区三区| 欧美一区二区三区四区高清| 久久亚洲精精品中文字幕早川悠里 | 欧美日韩免费一区二区三区视频| 日韩午夜激情电影| 亚洲精品视频在线观看网站| 另类的小说在线视频另类成人小视频在线| 成人午夜电影久久影院| 欧美日韩成人综合| 国产精品女人毛片| 蜜桃一区二区三区在线| 99久久国产免费看| 精品成a人在线观看| 亚洲激情成人在线| 国产成人精品免费在线| 欧美另类变人与禽xxxxx| 亚洲国产高清aⅴ视频| 日本不卡在线视频| 91精品福利在线| 国产精品美女久久福利网站| 蜜臀av一区二区三区| 91精品办公室少妇高潮对白| 国产日韩欧美精品在线| 五月激情综合网| 欧美性猛片aaaaaaa做受| 国产精品久久久久久久第一福利 | 91视频.com| 亚洲国产精品成人综合色在线婷婷| 卡一卡二国产精品| 欧美丰满高潮xxxx喷水动漫 | 日韩成人伦理电影在线观看| 91啪九色porn原创视频在线观看| 久久综合国产精品| 韩日欧美一区二区三区| 欧美一级高清片| 日本视频一区二区三区| 欧美浪妇xxxx高跟鞋交| 亚洲一区二区三区四区在线观看| 色域天天综合网| 一区二区三区在线视频观看58| 91女厕偷拍女厕偷拍高清| 1024国产精品| 一本大道综合伊人精品热热| 亚洲欧美一区二区久久 |