各位老大我是菜鸟,真的被逼疯了啊!!!!
我编了一个程序,是用来做课程设计的!!!
作用很简单,就是给出已知数据,按照下面的公式计算出结果就行了!!
#include<math.h>
#include<stdio.h>
#define pi 3.1415926
void main()
{
int A1,w1,L1,L3,L4,L6,l6;
double A3,A4,S3,s3,w3,w4,a3,SE,VE,aE;
FILE *in;
if((in=fopen("D:\\results.txt","w"))==NULL)
{printf("cannot open in\n");
exit(0);
}
A1=0;
w1=5;
A3=0;
L1=110;
L3=650;
L4=220;
L6=350;
l6=645;
for(A1=0;A1<=360;A1=A1+2)
{
A3=atan(((L6+L1*sin(A1*pi/180))/(L1*cos(A1*pi/180)));
S3=L1*cos(A1*pi/180)/cos(A3);
s3=-w1*L1*sin(A1*pi/180-A3);
w3=w1*L1*cos(A1*pi/180-A3)/S3;
a3=(pow(w1,2)*L1*sin(A3-A1*pi/180)-2*w3*s3)/S3;
A4=asin((l6/L4-L3*sin(A3)/L4));
SE=L3*cos(A3)+L4*cos(A4);
VE=(-w3)*L3*sin(A3-A4)/cos(A4);
w4=(-w3)*L3*cos(A3)/(L4*cos(A4));
aE=-(a3*L3*sin(A3-A4)+pow(a3,2)*L3*cos(A3-A4)-pow(a4,2)*L4)/cos(A4);
printf("\nA3=%5.3f,S3=%5.3f,s3=%5.3f,w3=%5.3f,a3=%5.3f,A4=%5.3f,SE=%5.3f,VE=%5.3f,w4=%5.3f,aE=%5.3f\n",A3,S3,s3,w3,a3,A4,SE,VE,w4,aE);
fprintf(in,"\nA3=%5.3f,S3=%5.3f,s3=%5.3f,w3=%5.3f,a3=%5.3f,A4=%5.3f,SE=%5.3f,VE=%5.3f,w4=%5.3f,aE=%5.3f\n",A3,S3,s3,w3,a3,A4,SE,VE,w4,aE);
}
fclose(in);
}
主要就是A3啊,怎么都是错!!!!!!!!!!!