#include#include void main() { float pi,e1,e2,m,x0,x1,x2,tfc,pm0,pm1,pm2,w,t,d,pm; float k1,k2,k3,k4,l1,l2,l3,l4,deld,delw,dg; FILE *fp1,*fp2; fp1=fopen("input.dat","r"); fp2=fopen("output.txt","w"); fscanf(fp1,"%f%f%f%f%f%f%f%f",&pi,&e1,&e2,&m,&x0,&x1,&x2,&tfc); pm0=(e1*e2)/x0; pm1=(e1*e2)/x1; pm2=(e1*e2)/x2; w=0; d=asin(pi/pm0); for(t=0;t<=1;t=t+.05) { dg=d*180/3.1414; fprintf(fp2,"\n%f%f",t,dg); if(t =tfc) pm=pm2; k1=w*.05; l1=(pi-pm*sin(d))*.05/m; k2=(w+.5*l1)*.05; l2=(pi-pm*sin(d+.5*k1))*.05/m; k3=(w+.5*l2)*.05; l3=(pi-pm*sin(d+.5*k2))*.05/m; k4=(w+l3)*.05; l4=(pi-pm*sin(d+k3))*.05/m; deld=(k1+2*k2+2*k3+k4)/6; delw=(l1+2*l2+2*l3+l4)/6; d=d+deld; w=w+delw; } } Input data for swing curve: Pi = 0.9 e1=1.1 e2=1.0 M=0.016
Monday, November 21, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment