3、th.h>#definepi3.1415926voidconv(floatu[],floatv[],floatw[],intm,intn);//voidplot(intxlenth,float*y,char*name,intgain,char*xlabel,char*ylabel);voidmain(){inti,j;intm,n;intgain=1;inty11,y22;charname='f';charxlabel='X',ylabel='Y';floatxa[650]={0.0},xb[650]={0.0},h[650]={0.
4、0},y1[650]={0.0},y2[650]={0.0};for(i=0;i<600;i++)xa[i]=sin(2*pi/55.0*i);for(i=0;i<600;i++)xb[i]=sin(2*pi/55.0*i)+sin(2*pi*20.0/55.0*i);for(j=0;j<=49;j++)h[j]=1.0;m=sizeof(xa)/sizeof(xa[0]);n=sizeof(xb)/sizeof(xb[0]);//a=sizeof(h)/sizeof(h[0]);y11=sizeof(y1)/sizeof(y1[0]
5、);y22=sizeof(y2)/sizeof(y2[0]);conv(xa,h,y1,m,n);conv(xb,h,y2,m,n);y11=sizeof(y1)/sizeof(y1[0]);y22=sizeof(y2)/sizeof(y2[0]);//plot(y11,y1,s,gain,xlabel,ylabel);initgraph(1000,500);initgraph(960,480,SHOWCONSOLE);//初始化图像setbkcolor(WHITE);//用背景色清空屏幕cleardevice();//用背景色清空屏
6、幕setcolor(BLACK);outtextxy(480,10,name);//图像名outtextxy(900,220,xlabel);//outtextxy(5,10,ylabel);//line(0,240,960,240);//画横坐标轴line(30,0,30,480);//画纵坐标轴setlinestyle(PS_DASHDOT);setlinestyle(PS_SOLID);setlinecolor(BLUE);for(i=0;i<650;i++)line(100+i,50,100+i,xa[i]*25+50);fo
7、r(i=0;i<650;i++)line(100+i,150,100+i,xb[i]*25+150);for(i=0;i<650;i++)line(100+i,280,100+i,y1[i]*5+280);for(i=0;i<650;i++)line(100+i,400,100+i,y2[i]*5+400);getchar();closegraph;//卷积子程序}voidconv(floatu[],floatv[],floatw[],intm,intn){inti,j;intk=m+n-1;for(i=0;i8、=max(0,i+1-n);j<=min(i,m-1);j++){w[i]+=u[j]*v[i-j];}}//画图函数参数xlength:序列长度y:序列幅度s:图像名gain:y坐标轴增益,用来显示y坐标xlabel: