#include<ccbp.h>
const PI=3.1415926;
const k1=0.286514963993;
void zuni()
{
float x1,x2,x3,dt=0.05,w,k=0.1,m=1.449275362319,Ep,Ek,E,b;
int t;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
setbkcolor(0);
outhzxy3(0,0,"请输入阻尼振动阻尼系数:",1,0,15);
outhzxy3(0,20,"范围是:",1,0,15);
printf("\n\n\n0<b<0.001\n");
outhzxy3(0,67,"建议使用:",1,0,15);
printf("\n\nb=0\n");
outhzxy3(40,97,"为简谐振动",1,0,15);
printf("\nb=0.0005\n");
outhzxy3(70,127,"为阻尼振动",1,0,15) ;
printf("\nb=");
outhzxy3(350,30,"自动化零四零二班:王志伟",1,0,15);
scanf("%f",&b) ;
cleardevice();
outhzxy3(250,0,"阻尼振动",2,0,6);
outhzxy3(350,35,"自动化零四零二班:王志伟",1,0,12);
outhzxy3(53,60,"振子",1,0,15);
outhzxy3(155,60,"旋转矢量",1,0,4);
outhzxy3(265,60,"振动位置",1,0,15);
setcolor(7);
outtextxy(240,135,"0");
outtextxy(240,365,"0");
outtextxy(630,135,"t");
outtextxy(630,365,"t");
outtextxy(218,276,"Emax");
setfillstyle(2,6);
bar(15,210,123,218);
outhzxy3(60,270,"青:代表总能量",1,0,11);
outhzxy3(60,300,"白:代表动能",1,0,15);
outhzxy3(60,330,"红:代表势能",1,0,4);
coordc(130,130,500,0,150,1);coordc(250,210,160,90,50,1);
coordc(130,360,500,0,150,1);coordc(250,400,160,90,50,1);
w=sqrt(k/m);
for(t=0;t<9567/4;t++)
{
x1=-40*exp(-b*t)*sin(w*t*dt);
x2=10*w*t*0.286514963993;
x3=40*exp(-b*t)*cos(w*t*dt);
Ep=-k*x1*x1/2;
Ek=-m*w*w*x3*x3/2;
E=-k*40*exp(-b*t)*40*exp(-b*t)/2;
setcolor(14);
setfillstyle(1,0);
bar(15,83,123,210);
setfillstyle(6,15);
bar(53,123+x1,85,137+x1);
spring(69,210,69,130+x1,5,20);
setlinestyle(1,16,1);
line(18,90,120,90);
line(18,130,120,130);
line(18,170,120,170);
setfillstyle(1,0);
fillellipse(190,130,40,40);
setcolor(15);
circle(190,130,40*exp(-b*t));
setlinestyle(1,16,1);
line(190,170,190,90);
line(150,130,230,130);
setlinestyle(0,16,1);
coordc(190,130,40*exp(-b*t),x2,40,14);
setlinestyle(3,16,1);
setcolor(4);
line(69,130+x1,190+x3,130+x1);
if(cos(w*t*dt)>=0)
{
setfillstyle(1,0);
bar(69,131+x1,190+x3,131+x1);
}
else
{
setfillstyle(1,0);
bar(69,129+x1,190+x3,129+x1);
}
setfillstyle(1,0);
fillellipse(570,130,40,40);
setcolor(15);
circle(570,130,40*exp(-b*t));
setlinestyle(1,16,1);
line(570,170,570,90);
line(530,130,610,130);
setlinestyle(0,16,1);
coordc(570,130,40*exp(-b*t),x2,40,14);
setlinestyle(3,16,1);
setcolor(4);
line(570+x3,130+x1,251+t/9,130+x1);
if(cos(w*t*dt)>=0)
{
setfillstyle(1,0);
bar(570+x3,131+x1,251+t/9,131+x1);
}
else
{
setfillstyle(1,0);
bar(570+x3,129+x1,251+t/9,129+x1);
}
setlinestyle(0,16,1);
setfillstyle(1,1);
bar(250,130,530,130);
bar(250,210,250,60);
putpixel(250+t/9,130+x1,14);
putpixel(250+t/9,360+Ep,4);
putpixel(250+t/9,360+Ek,15);
putpixel(250+t/9,360+E,11);
}
}
void ouhe1()
{
float x1,x2,dt=0.05,w,w1,k=0.1,m=10,l=100,y1,y2,g=9.8;
int t;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
setbkcolor(0);
outhzxy3(250,0,"耦合摆模型一",1,0,6);
setfillstyle(2,6);
bar(140,30,158,40);bar(220,30,238,40);
coordc(100,250,450,0,150,1);coordc(100,250,80,90,50,1);
coordc(100,360,450,0,150,1);coordc(100,360,80,90,50,1);
setcolor(8);
outtextxy(90,255,"0"); outtextxy(560,255,"t");
outtextxy(90,365,"0"); outtextxy(560,365,"t");
setcolor(15);
outtextxy(130,33,"A"); outtextxy(242,33,"B");
outhzxy3(350,40,"自动化零四零二班:王志伟",1,0,12);
outhzxy3(360,190,"摆A的幅角",1,0,8);
outhzxy3(360,300,"摆B的幅角",1,0,8);
outhzxy3(380,90,"二摆振动相位垂直",1,0,15);
w1=sqrt(g/l);w=sqrt(g/l+2*k/m);
for(t=0;t<8000;t++)
{
setfillstyle(1,0);
bar(115,42,260,160);
x1=16*cos((w-w1)*t*dt/2)*cos((w+w1)*t*dt/2);
x2=16*sin((w-w1)*t*dt/2)*sin((w+w1)*t*dt/2);
y1=l-sqrt(l*l-x1*x1);
y2=l-sqrt(l*l-x2*x2);
setcolor(15);
line(149,40,149+x1,40+l-y1);
line(229,40,229+x2,40+l-y2);
setfillstyle(6,14);
fillellipse(149+x1,40+l-y1,15,15);
setfillstyle(6,15);
fillellipse(229+x2,40+l-y2,15,15);
spring(149+x1,40+l-y1,229+x2,40+l-y2,5,20);
putpixel(100+t/21,250+200*x1/l,14);
putpixel(100+t/21,360+200*x2/l,15);
}
}
void ouhe2()
{
float x1,x2,dt=0.05,w,w1,k=0.1,m=10,l=100,y1,y2,g=9.8;
int t;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
setbkcolor(0);
outhzxy3(250,0,"耦合摆模型二",1,0,6);
setfillstyle(2,6);
bar(140,30,158,40);bar(220,30,238,40);
coordc(100,250,450,0,150,1);coordc(100,250,80,90,50,1);
coordc(100,360,450,0,150,1);coordc(100,360,80,90,50,1);
setcolor(8);
outtextxy(90,255,"0"); outtextxy(560,255,"t");
outtextxy(90,365,"0"); outtextxy(560,365,"t");
setcolor(15);
outtextxy(130,33,"A"); outtextxy(242,33,"B");
outhzxy3(350,40,"自动化零四零二班:王志伟",1,0,12);
outhzxy3(360,190,"摆A的幅角",1,0,8);
outhzxy3(360,300,"摆B的幅角",1,0,8);
outhzxy3(380,90,"二摆振动同步进行",1,0,15);
w1=sqrt(g/l);w=sqrt(g/l+2*k/m);
for(t=0;t<8000;t++)
{
setfillstyle(1,0);
bar(115,42,260,160);
x1=x2=16*cos(w1*t*dt);
y1=l-sqrt(l*l-x1*x1);
y2=l-sqrt(l*l-x2*x2);
setcolor(15);
line(149,40,149+x1,40+l-y1);
line(229,40,229+x2,40+l-y2);
setfillstyle(6,14);
fillellipse(149+x1,40+l-y1,15,15);
setfillstyle(6,15);
fillellipse(229+x2,40+l-y2,15,15);
spring(149+x1,40+l-y1,229+x2,40+l-y2,5,20);
putpixel(100+t/21,250+200*x1/l,14);
putpixel(100+t/21,360+200*x2/l,15);
}
}
void ouhe3()
{
float x1,x2,dt=0.05,w,w1,k=0.1,m=10,l=100,y1,y2,g=9.8;
int t;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
setbkcolor(0);
outhzxy3(250,0,"耦合摆模型三",1,0,6);
setfillstyle(2,6);
bar(140,30,158,40);bar(220,30,238,40);
coordc(100,250,450,0,150,1);coordc(100,250,80,90,50,1);
coordc(100,360,450,0,150,1);coordc(100,360,80,90,50,1);
setcolor(8);
outtextxy(90,255,"0"); outtextxy(560,255,"t");
outtextxy(90,365,"0"); outtextxy(560,365,"t");
setcolor(15);
outtextxy(130,33,"A"); outtextxy(242,33,"B");
outhzxy3(350,40,"自动化零四零二班:王志伟",1,0,12);
outhzxy3(360,190,"摆A的幅角",1,0,8);
outhzxy3(360,300,"摆B的幅角",1,0,8);
outhzxy3(380,90,"二摆振动反向进行",1,0,15);
w1=sqrt(g/l);w=sqrt(g/l+2*k/m);
for(t=0;t<8000;t++)
{
setfillstyle(1,0);
bar(115,42,260,160);
x1=16*cos(w*t*dt+PI);
x2=-16*cos(w*t*dt+PI);
y1=l-sqrt(l*l-x1*x1);
y2=l-sqrt(l*l-x2*x2);
setcolor(15);
line(149,40,149+x1,40+l-y1);
line(229,40,229+x2,40+l-y2);
setfillstyle(6,14);
fillellipse(149+x1,4
wangzhiwei.rar_coupled oscillator_振动_耦合_耦合振动_阻尼
版权申诉
27 浏览量
2022-09-20
13:42:33
上传
评论
收藏 2KB RAR 举报
小贝德罗
- 粉丝: 70
- 资源: 1万+
最新资源
- 基于Typescript的兔子饭店经营类游戏源码设计免费送cocoscreator
- 基于Java的web快速开发数据权限管理脚手架wonder-server设计源码
- 基于Apache Log4cxx的C++日志库设计源码
- 基于Vue3的likeadmin免费任意商用管理后台设计源码
- 基于JavaScript的Chrome扩展WeNote分享插件设计源码
- 基于C++的中泰EM9108S动态库开发示例源码
- gxlx2-p291-1g.dts和gxlx2-p291-1g.dtb
- STM32WBxx Keil芯片包
- 基于CNN+Bi-LSTM+Attention 的自动对对联系统
- 基于Java的IndexBar Android字母索引栏设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈