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

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

?? fsample.c

?? DSP信號處理源碼,包括數字信號處理課程中的基本源程序。
?? C
字號:
/**********************************************************************
FSAMPLE.C -  取樣混迭演示程序

dft          離散傅里葉變換函數
idft         IDFT 函數
draw_image   繪圖子程序
***********************************************************************/

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

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

#define    PI	(4.0*atan(1.0))

 void idft(COMPLEX *Datain, COMPLEX *Dataout, int N);
 void dft(COMPLEX *Datain, COMPLEX *Dataout, int N);
 void draw_image(double *x,int m,char *title1,char *title2,
		 char *xdis1,char *xdis2,int dis_type);

/********************************************************/
void main(void)
{
  int          i,j,k,length,m,type;
  char         title1[80],title2[80],tmp1[20],tmp2[20];
  double       far *amp;
  COMPLEX      far *fsamp, far *tsamp, far *ssamp;

  length = 256; /* length is the display sample size */

  amp = (double *) farcalloc(length+1,sizeof(double));
  ssamp = (COMPLEX *) farcalloc(length+1,sizeof(COMPLEX));
  fsamp = (COMPLEX *) farcalloc(length+1,sizeof(COMPLEX));
  tsamp = (COMPLEX *) farcalloc(length+1,sizeof(COMPLEX));
	if(!tsamp) {
	    printf("\nUnable to allocate complex array for calculation\n");
	    exit(1);
	}

  /* Input frequency sampling data for processing */
  for (i = 0; i < length; i++) {
     if(i<length/14) fsamp[i].real = 24.0-24.0*14.0*i/length;
     else if(i>length-length/14) fsamp[i].real = 24.0*14.0*i/length-24.0*14.0+24.0;
     else fsamp[i].real = 0;
     fsamp[i].imag=0;
  }

  printf("Generate the Signal. Waitting for the calculation...\n");
  idft(fsamp, ssamp, length);
  for(i = 0; i< length; i++)
     amp[i]=ssamp[i].real;

  strcpy(title1,"The Signal Data Sequency");
  strcpy(title2,"The Magnitude of Signal");
  strcpy(tmp1,"0");
  gcvt((float)length/2/70,5,tmp2);
  strcat(tmp2,"(s) t");
  draw_image(amp,length,title1,title2,tmp1,tmp2,0);

  /* Resample with fs = 10 Hz */
  for (i = 0 ; i < length/7 ; i++) {
    tsamp[i].real = ssamp[i*7].real;
    tsamp[i].imag = ssamp[i*7].imag;
  }

  printf("Waitting for the calculation...\n");
  dft(tsamp, fsamp, (int)(length/7));

  for(i = 0; i< length/7; i++)
     amp[i]=fsamp[i].real;

  strcpy(title1,"The Signal Spectrum fs=10Hz");
  strcpy(title2,"The Spectrum Magnitude");
  strcpy(tmp1,"0");
  strcpy(tmp2,"2*PI");
  draw_image(amp,(int)(length/7),title1,title2,tmp1,tmp2,0);

  /* Resample with fs = 7 Hz */
  for (i = 0 ; i < length/10 ; i++) {
    tsamp[i].real = ssamp[i*10].real;
    tsamp[i].imag = ssamp[i*10].imag;
  }

  printf("Waitting for the calculation...\n");
  dft(tsamp, fsamp, (int)(length/10));

  for(i = 0; i< length/10; i++)
     amp[i]=fsamp[i].real;

  strcpy(title1,"The Signal Spectrum fs=7Hz");
  strcpy(title2,"The Spectrum Magnitude");
  strcpy(tmp1,"0");
  strcpy(tmp2,"2*PI");
  draw_image(amp,(int)(length/10),title1,title2,tmp1,tmp2,0);

  /* Resample with fs = 14 Hz */
  for (i = 0 ; i < length/5 ; i++) {
    tsamp[i].real = ssamp[i*5].real;
    tsamp[i].imag = ssamp[i*5].imag;
  }

  printf("Waitting for the calculation...\n");
  dft(tsamp, fsamp, (int)(length/5));

  for(i = 0; i< length/5; i++)
     amp[i]=fsamp[i].real;

  strcpy(title1,"The Signal Spectrum fs=14Hz");
  strcpy(title2,"The Spectrum Magnitude");
  strcpy(tmp1,"0");
  strcpy(tmp2,"2*PI");
  draw_image(amp,(int)(length/5),title1,title2,tmp1,tmp2,0);

  farfree(fsamp);
  farfree(ssamp);
  farfree(tsamp);
  farfree(amp);
}

/***********************************************************************
dft -  離散傅里葉正變換子程序
輸入參數:
	  COMPLEX *Datain : 輸入數據區指針;
	  COMPLEX *Dataout: 輸出數據區指針;
		   int  N : 數據長度;
輸出參數:
	  輸出數據存放在 Dataout 所指的數據區;
	  無輸出參數.

void dft(COMPLEX *Datain, COMPLEX *Dataout, int N)
************************************************************************/
void dft(COMPLEX *Datain, COMPLEX *Dataout, int N)
{
    int i,k,n,p;
    static int nstore = 0;      /* store N for future use */
    static COMPLEX *cf;         /* coefficient storage */
    COMPLEX *cfptr,*Dinptr;
    double arg;

/* Create the coefficients if N has changed */

    if(N != nstore) {
	if(nstore != 0) free((char *) cf);    /* free previous */

	cf = (COMPLEX  *) calloc(N, sizeof(COMPLEX));
	if (!cf) {
	    printf("\nUnable to allocate memory for coefficients.\n");
	    exit(1);
	}

	arg = 8.0*atan(1.0)/N;
	for (i=0 ; i<N ; i++) {
	    cf[i].real = (float)cos(arg*i);
	    cf[i].imag = -(float)sin(arg*i);
	}
    }

/* Perform the DFT calculation */

    printf("\n");
    for (k=0 ; k<N ; k++) {

	Dinptr = Datain;
	Dataout->real = Dinptr->real;
	Dataout->imag = Dinptr->imag;
	Dinptr++;
	for (n=1; n<N; n++) {

	p = (int)((long)n*k % N);
	    cfptr = cf + p;         /* pointer to cf modulo N */

	    Dataout->real += Dinptr->real * cfptr->real
			     - Dinptr->imag * cfptr->imag;

	    Dataout->imag += Dinptr->real * cfptr->imag
			     + Dinptr->imag * cfptr->real;
	    Dinptr++;
	}
	if (k % 32 == 31) printf("*");
	Dataout++;          /* next output */
    }
    printf("\n");
}

/***********************************************************************
idft - 離散傅里葉反變換子程序
輸入參數:
	  COMPLEX *Datain : 輸入數據區指針;
	  COMPLEX *Dataout: 輸出數據區指針;
		   int  N : 數據長度;
輸出參數:
	  輸出數據存放在 Dataout 所指的數據區;
	  無輸出參數.

void idft(COMPLEX *Datain, COMPLEX *Dataout, int N)
************************************************************************/
void idft(COMPLEX *Datain, COMPLEX *Dataout, int N)
{
    int i,k,n,p;
    static int nstore = 0;      /* store N for future use */
    static COMPLEX *cf;         /* coefficient storage */
    COMPLEX *cfptr,*Dinptr;
    double arg;

/* Create the coefficients if N has changed */

    if(N != nstore) {
        if(nstore != 0) free((char *) cf);    /* free previous */

        cf = (COMPLEX  *) calloc(N, sizeof(COMPLEX));
        if (cf == 0) {
            printf("\nUnable to allocate memory for coefficients.\n");
            exit(1);
        }

/* scale stored values by 1/N */
        arg = 8.0*atan(1.0)/N;
	for (i=0 ; i<N ; i++) {
            cf[i].real = (float)(cos(arg*i)/(double)N);
            cf[i].imag = (float)(sin(arg*i)/(double)N);
        }
    }

/* Perform the DFT calculation */

    printf("\n");
    for (k=0 ; k<N ; k++) {

        Dinptr = Datain;
        Dataout->real = Dinptr->real * cf[0].real;
        Dataout->imag = Dinptr->imag * cf[0].real;
        Dinptr++;
        for (n=1; n<N; n++) {

        p = (int)((long)n*k % N);
            cfptr = cf + p;         /* pointer to cf modulo N */

	    Dataout->real += Dinptr->real * cfptr->real
                             - Dinptr->imag * cfptr->imag;

            Dataout->imag += Dinptr->real * cfptr->imag
                             + Dinptr->imag * cfptr->real;
            Dinptr++;
        }
        if (k % 32 == 31) printf("*");
	Dataout++;          /* next output */
    }
    printf("\n");
}

/************************************************************************
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一区二区三区免费野_久草精品视频
99国产精品一区| 精品在线免费视频| 美女久久久精品| 欧美日韩一区二区三区不卡| 国产精品久久看| 日本最新不卡在线| 欧美猛男男办公室激情| 亚洲电影中文字幕在线观看| 在线一区二区三区四区五区| 亚洲日本va午夜在线电影| jizz一区二区| 亚洲啪啪综合av一区二区三区| 99麻豆久久久国产精品免费优播| 日本成人在线不卡视频| 亚洲蜜臀av乱码久久精品| 久久久精品人体av艺术| 成人久久视频在线观看| 国产精品传媒在线| 国产亚洲短视频| 97国产一区二区| 国产69精品久久久久毛片| 夜夜揉揉日日人人青青一国产精品| 色婷婷亚洲精品| 免费在线一区观看| 欧美国产日韩精品免费观看| 色成年激情久久综合| 成人午夜电影网站| 国产精品一区二区视频| 亚洲色图色小说| 久久久99精品久久| 久久综合国产精品| 色综合一区二区三区| 日韩福利视频导航| 亚洲va韩国va欧美va| 久久综合九色综合欧美亚洲| 日韩一级免费观看| 国产精品亚洲第一区在线暖暖韩国 | 成人夜色视频网站在线观看| 久久精品二区亚洲w码| 国产精品每日更新| 欧美一级在线免费| 成人av网站在线观看免费| 天天影视网天天综合色在线播放| 久久久亚洲精华液精华液精华液| 日韩一级大片在线观看| 日韩午夜精品电影| 日韩欧美亚洲国产精品字幕久久久 | 国产精品色一区二区三区| 国产午夜三级一区二区三| 国产偷国产偷亚洲高清人白洁| 久久久不卡网国产精品一区| 国产校园另类小说区| 中文字幕欧美日韩一区| 国产精品国产自产拍高清av王其 | 亚洲少妇30p| 一区二区三区欧美亚洲| 一区二区三区成人| 亚洲bdsm女犯bdsm网站| 日本成人中文字幕| 国产一区二区三区美女| 亚洲国产视频一区二区| 欧美aaaaa成人免费观看视频| 久久国产麻豆精品| 国产精品99久久久| 色综合久久久久综合体| 欧美久久婷婷综合色| 91日韩在线专区| 国产尤物一区二区在线| 成人av电影在线播放| 欧美午夜电影在线播放| av网站免费线看精品| 一本大道综合伊人精品热热| 欧美一级久久久| 国产区在线观看成人精品| 日韩欧美视频在线| 国产欧美精品在线观看| 一区二区视频在线| 国产精品亲子伦对白| 一区二区三区在线影院| 麻豆精品久久精品色综合| 成人美女在线观看| 欧美日本一道本| 国产三区在线成人av| 亚洲黄色录像片| 国产一区二区三区美女| 一本到不卡免费一区二区| 日韩精品一区二区三区中文不卡| 国产精品精品国产色婷婷| 欧美96一区二区免费视频| 99久久国产免费看| 精品久久免费看| 久久一区二区三区国产精品| 一区二区欧美国产| 国产丶欧美丶日本不卡视频| 国产激情视频一区二区在线观看 | 中文一区二区完整视频在线观看| 亚洲小少妇裸体bbw| 国产aⅴ精品一区二区三区色成熟| 在线精品视频免费观看| 91视频精品在这里| 26uuu国产日韩综合| 亚洲影视资源网| 亚洲1区2区3区视频| 成人开心网精品视频| 欧美精品一区二区三区高清aⅴ | 欧美精品v日韩精品v韩国精品v| 国产亚洲美州欧州综合国| 午夜精品久久久久久久蜜桃app| 国产不卡免费视频| 精品少妇一区二区三区在线播放 | 亚洲 欧美综合在线网络| 成人美女在线观看| 久久日韩粉嫩一区二区三区| 日韩电影在线一区| 欧美图区在线视频| 亚洲美女偷拍久久| 成人福利电影精品一区二区在线观看| 日韩写真欧美这视频| 亚洲超碰97人人做人人爱| 99久久国产综合色|国产精品| 久久综合成人精品亚洲另类欧美| 蜜臀久久久99精品久久久久久| 欧美特级限制片免费在线观看| 日韩一区在线免费观看| 亚洲成人激情自拍| 欧美性色欧美a在线播放| 日韩美女精品在线| 91视频国产资源| 亚洲精品综合在线| 色综合激情久久| 亚洲一区二区三区视频在线播放| 91蜜桃在线观看| 亚洲精品第一国产综合野| 99在线精品视频| 中文字幕色av一区二区三区| 波多野结衣中文一区| 中文字幕中文字幕中文字幕亚洲无线| 成人在线一区二区三区| 国产精品视频线看| caoporn国产一区二区| 中文字幕一区二区5566日韩| aa级大片欧美| 亚洲最色的网站| 欧洲一区在线电影| 亚洲 欧美综合在线网络| 欧美一卡二卡三卡| 精品一区二区久久| 欧美国产精品劲爆| 成人丝袜高跟foot| 亚洲免费在线看| 91精品在线观看入口| 亚洲精品久久久蜜桃| 在线免费观看不卡av| 视频在线在亚洲| 97aⅴ精品视频一二三区| 亚洲综合一二三区| 欧美一区二区三区成人| 国产在线不卡视频| 综合色中文字幕| 538prom精品视频线放| 国产美女精品一区二区三区| 国产精品日产欧美久久久久| 在线观看亚洲成人| 乱一区二区av| 中文字幕第一区综合| 欧美日韩综合不卡| 国产一区三区三区| 亚洲欧美福利一区二区| 欧美一区二区三区影视| 国产不卡在线一区| 婷婷久久综合九色综合伊人色| 日韩午夜电影在线观看| 国产成人精品综合在线观看| 亚洲欧美在线视频| 4438成人网| 精品中文字幕一区二区小辣椒| 中文字幕欧美一区| 欧美亚洲一区二区在线| 日韩国产在线观看| 欧美一级片在线看| 国产精品中文字幕欧美| 亚洲男同1069视频| 99国产一区二区三精品乱码| 久久精品国产亚洲一区二区三区| 久久精品视频在线免费观看| 91美女在线观看| 激情综合色综合久久| 国产精品乱码一区二三区小蝌蚪| 色88888久久久久久影院按摩| 亚洲成在人线在线播放| 国产精品美女一区二区三区 | 天堂午夜影视日韩欧美一区二区| 精品国产三级a在线观看| 欧美写真视频网站| 九九九精品视频| 1000部国产精品成人观看| 欧美日韩和欧美的一区二区| 国产精品一区二区三区四区 | 亚洲一区二区偷拍精品| 精品久久国产字幕高潮|