周期矩形波周期锯齿波周期三角波C语言程序.docx
- 文档编号:27556538
- 上传时间:2023-07-02
- 格式:DOCX
- 页数:10
- 大小:22.71KB
周期矩形波周期锯齿波周期三角波C语言程序.docx
《周期矩形波周期锯齿波周期三角波C语言程序.docx》由会员分享,可在线阅读,更多相关《周期矩形波周期锯齿波周期三角波C语言程序.docx(10页珍藏版)》请在冰豆网上搜索。
周期矩形波周期锯齿波周期三角波C语言程序
集团文件发布号:
(9816-UATWW-MWUB-WUNN-INNUL-DQQTY-19882)
周期矩形波周期锯齿波周期三角波C语言程序
周期矩形波的C语言代码
#include
#include
#include
#include
#definepi3.1415926
#defineE2
#defineT12
doublefunction(doublet);
doublesum();
doubledraw();
doublefunction(doublet)
{
doublex,s,w,m;
intn,k;
w=2*pi/T1;
s=0;
for(n=1;n<=200;n++)
{
k=pow(-1,n-1);
x=cos((2*n-1)*w*t)/(2*n-1)*k;
s=x+s;
}
m=s*2*E/pi;
return(m);
}
voidcheck_initialize()
{
intdriver,mode;
detectgraph(&driver,&mode);
initgraph(&driver,&mode,"..\\bgi");}
doublesum()
{
doublec,t,m,x[301],s[300];
inti,g,y,j;
x[0]=0;
for(i=1;i<=200;i++)
{setcolor(5);
x[i]=x[i-1]+0.02;
c=x[i];
s[i]=function(c);
line(100*x[i-1]+20,-100*s[i-1]+300,100*x[i]+20,-100*s[i]+300);
}
return0;
}
doubledraw()
{
intl,b[61],c[60];
b[0]=200;
setcolor(9);
line(10,300,600,300);
line(20,410,20,30);
setcolor(6);
line(15,35,20,30);
line(25,35,20,30);
line(595,295,600,300);
line(595,305,600,300);
for(l=1;l<=25;l++)
{
b[l]=b[l-1]+4;
c[l]=220;
putpixel(c[l],b[l],5);
}
outtextxy(10,25,"Y");
outtextxy(605,305,"X");
outtextxy(220,300,"2");
outtextxy(10,200,"1");
outtextxy(10,300,"0");
return0;
}
voidmain()
{
check_initialize();
setbkcolor(15);
sum();
draw();
getch();
}
周期三角波C语言代码
#include
#include
#include
#include
#definepi3.1415926
#defineE2
#defineT12
doublefunction(doublet);
doublesum();doubledraw();
doublefunction(doublet)
{
doublex,s,w,m;
intn;
w=2*pi/T1;
s=0;
for(n=1;n<=200;n++)
{
x=cos((2*n-1)*w*t)/((2*n-1)*(2*n-1));
s=x+s;
}
m=s*4*E/(pi*pi)+E/2;
return(m);
}
voidcheck_initialize()
{
intdriver,mode;
detectgraph(&driver,&mode);
initgraph(&driver,&mode,"..\\bgi");}
doublesum()
{
doublec,t,m,x[301],s[300];
inti,g,y,j;
x[0]=0;
for(i=1;i<=200;i++)
{setcolor(5);
x[i]=x[i-1]+0.02;
c=x[i];
s[i]=function(c);
line(100*x[i-1]+20,-100*s[i-1]+400,100*x[i]+20,-100*s[i]+400);
}
return0;
}
doubledraw()
{
intl,b[61],c[60];
b[0]=200;
setcolor(9);
line(10,400,600,400);
line(20,410,20,30);
setcolor(6);
line(15,35,20,30);
line(25,35,20,30);
line(595,395,600,400);
line(595,405,600,400);
for(l=1;l<=50;l++)
{
b[l]=b[l-1]+4;
c[l]=220;
putpixel(c[l],b[l],5);
}
outtextxy(10,25,"Y");
outtextxy(605,405,"X");
outtextxy(220,400,"2");
outtextxy(10,200,"2");
outtextxy(10,400,"0");
return0;
}
voidmain()
{
check_initialize();
setbkcolor(15);
sum();
draw();
getch();
}
周期锯齿波的C语言代码
#include
#include
#include
#include
#definepi3.1415926
#defineE2
#defineT12
doublefunction(doublet);
doublesum();doubledraw();
doublefunction(doublet)
{
doublex,s,w,k,m;
intn;
w=2*pi/T1;
s=0;
for(n=1;n<=200;n++)
{
k=pow(-1,n-1);
x=sin(n*w*t)/n*k;
s=x+s;
}
m=s*E/pi;
return(m);
}
voidcheck_initialize()
{
intdriver,mode;
detectgraph(&driver,&mode);
initgraph(&driver,&mode,"..\\bgi");}
doublesum()
{
doublec,t,m,x[301],s[300];
inti,g,y,j;
x[0]=0;
for(i=1;i<=200;i++)
{setcolor(5);
x[i]=x[i-1]+0.02;
c=x[i];
s[i]=function(c);
line(100*x[i-1]+20,-100*s[i-1]+300,100*x[i]+20,-100*s[i]+300);
}
return0;
}
doubledraw()
{
intl,b[61],c[60];
b[0]=20;
setcolor(9);
line(10,300,600,300);
line(20,310,20,30);
setcolor(6);
line(15,35,20,30);
line(25,35,20,30);
line(595,295,600,300);
line(595,305,600,300);
for(l=1;l<=25;l++)
{
b[l]=b[l-1]+4;
c[l]=205;
putpixel(b[l],c[l],5);
}
outtextxy(10,25,"Y");
outtextxy(605,305,"X");
outtextxy(220,300,"2");
outtextxy(10,200,"1");
outtextxy(10,300,"0");
return0;
}
voidmain()
{
check_initialize();
setbkcolor(15);
sum();
draw();
getch();
}
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 周期 矩形 锯齿 三角 语言 程序