资源简介
通过使用C语言实现卷积的计算过程,实现对任意长度的两个序列进行卷积的求解过程并对,结果绘制出图形
代码片段和文件信息
#include “stdio.h“
#include “math.h“
#include“graphics.h“
void main(){
void linearconv(int x[]int h[]int Nint M);
void rotconv(int x[] int h[] int N int M);
int M;
int N;
int i;
int x[100] = {0};
int h[200] = {0};
for(i=0;i<100;i++)
x[i]=1;
for(i=0;i<200;i++)
h[i]=1;
// printf(“the result of linearconv : \n“);
linearconv(xh 100200);
// printf(“the result of rotateconv : \n“);
rotconv(x h 100 200);
}
/* xianxingjuanji */
void linearconv(int x[] int h[] int N int M){
int i ;
int n ;
int m;
//int sum = 0 ;
int y[1000]={0};
//int drivermode;
//driver=DETECT;
//mode=0;
initgraph(800800);
printf(“the result of xianxingjuanji : \n“);
for (n = 0;n for(i = 0;i if ((n-i>=0)&&(n-i { y[n] = y[n]+x[i]*h[n-i];
//y[n]=sum;
//i++;
}
}
printf(“ %d “ y[n]) ;
}
for(i=0;i line(2*i2002*i200-y[i]);
//lineto(100100);
//linerel(3664);
//scanf(“%d“&m);
g
评论
共有 条评论