当前位置:文档之家› C语言机械原理编程,连杆运动分析图线

C语言机械原理编程,连杆运动分析图线

t=-k*40/20-120;
setcolor(GREEN);
line(m11,t11,m1,t);
m11=m1,t11=t;
k=l3;
m1=n*600/360;
t=-k*40/(0.05)-80;
setcolor(MAGENTA);
line(m12,t12,m1,t);
m12=m1,t12=t;
n+=0.1;
i+=10;
}
outtextxy(-85,-420, "θ2、θ3/度");
}
int main()
{
//创建大小为800 * 600的绘图窗口
initgraph(800, 600);
//设置原点(0, 0)为屏幕中央(Y轴默认向下为正)
setorigin(100, 500);
//使用白色填充背景
setbkcolor(WHITE);
//输出屏幕提示
settextcolor(BLACK);
setfont(18,0,"宋体");
danwei();
danwei1();
settextcolor(RED);
danwei2();
settextcolor(RGB(201, 62, 0));
outtextxy(240,-450, "角度关系图");
void matrixmultiplication(float a_2[2][2],float b_2[2][1],float y[2][1])
{
int i,j,k,a_column=2,a_row=2,b_row=1;
float temp;
for(i=0;i<a_column;i++)
{
for(j=0;j<b_row;j++)
o2=2*atan(D);
m=o2*180/PI;
l3=(l1*cos(o1)-l2*cos(o2))/sin(o2);
k=m;
m1=n*600/360;
t=-k*40/20-120;
setcolor(BLACK);
line(m10,t10,m1,t);
m10=m1,t10=t;
k=m+90;
m1=n*600/360;
k-=40;
i+=0.05;
}
outtextxy(610,-420, "l3/m/s");
}
void danwei1()
{
char s[10];
int i=-60;
int k=-10;
while(k>=-400)
{
sprintf(s,"%d",i);
outtextxy(-30,k,s);
k-=20;
编程大作业
基于C语言的机械原理分析图:
只有库函数包含头文件:graphics.h
conio.h
才能观看该程序效果;
若已经安装VC++,可以打开文件夹里面的EasyX压缩包,并安装EasyX文件,也可以观看程序效果;
1、角度与l3与角1的关系;
#include <graphics.h>
#include <conio.h>
return 0;
}
二、角速度、vl3与角一的关系;
#include <graphics.h>
#include <conio.h>
#include<stdio.h>
#include<math.h>
#define SZ 2
#define PI 3.1415926
float c[SZ][SZ]={0};
}
settextcolor(GREEN);
outtextxy(160,-80, "θ2");
outtextxy(160,-180, "L3");
outtextxy(160,-260, "θ3");
outtextxy(500,60, "莫智斌/2014124066");
getch();
closegraph();
#include<stdio.h>
#include<math.h>
#define SZ 2
#define PI 3.1415926
float c[SZ][SZ]={0};
void danwei()
{
char s[5];
int i=0;
int k=-5;
while(k<=600)
{
sprintf(s, "%d", i);
cleardevice();
setlinecolor(RGB(7, 190, 234));
rectangle(0,-400,600,0);
int i,j;
//网格线
for(i=0;i<600;i=i+20)
line(i,0,i,-400);
for(j=0;j<400;j=j+20)
line(0,-j,600,-j);
outtextxy(k, 5, s);
k+=75;
i+=45;
}
outtextxy(280,25, "θ1/度");
}
void danwei2() //右边的纵坐标
{
char s[10];
float i=-2;
outtextxy(k, 5, s);
k+=75;
i+=45;
}
outtextxy(280,25, "θ1/度");
}
void danwei2()
{
char s[10];
float i=-0.1;
int k=-10;
while(k>=-400)
{
sprintf(s,"%0.2f",i);
outtextxy(610,k,s);
float o3,o1,o2,w1=10;
float temp1;
float l1=0.100,l2=0.040,l4=0.200;
float l3,m,m1,A,B,C,D;
float a[2][2]={0},b[2][1]={0},a1[2][2]={0};
float k,t,m10=0,t10=-16.2602*40/20-120,m11=0,
t11=(-(16.2602+90))*40/20-120,m12=0,t12=-0.22*40/(0.05)-80;
float n=0;
while(n<=360)
{
o1=n*PI/180;
A=l1*sin(o1)-l4;
B=l1*cos(o1);
C=-l2;
D=(A+sqrt(pow(A,2)+pow(B,2)-pow(C,2)))/(B-C);
{ temp=0;
for(k=0;k<a_row;k++)
{
temp+=a_2[i][k]*b_2[k][j];
}
danwei() //横坐标
{
char s[5];
int i=0;
int k=-5;
while(k<=600)
{
sprintf(s, "%d", i);
相关主题