資源描述:
《拉桿機(jī)構(gòu)源程序.doc》由會(huì)員上傳分享,免費(fèi)在線(xiàn)閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、拉桿機(jī)構(gòu)(C語(yǔ)言源程序)#inelude#include#definePI3.14159#defineElle-2#defineEOle-9#definem4#defineNO500〃控制牛頓迭代次數(shù)doubleF(doublex[mj,doublet2,intn)〃角位移代數(shù)式組{doublep[m];p[0]=0.4*cos(t2*PI/180)4-1.650*cos(x[0])+1.0*cos(x[l])-x[3];p[l]=0?4*sin(t2*PI/l8
2、0)+1.650*sin(x[0])-1.0*sin(x[l])-0.358;p[2]=0?4*cos(t2*PI/180)+l?650*cos(x[0])+0?6*cos(x[l])-0.800*cos(x⑵)?l?0;p⑶=0.4*sin(t2*PI/180)+l?650*sin(x[0])?0.6*sin(x[l])-0?800*sin(x[2J);returnp[n];}doubleA(doublex[m]Jnti,intj)〃建立雅可比矩陣{doublep[m][m];p[0][0]=-
3、1.650^sin(x[0]);p[0][1]=-1.0*sin(x[1]);p[0][2]=0;p[0][3]=-1■'p[l][0]=1.650*cos(x[0]);p[l][l]=-1.0*cos(x[l]);p[l][2]=0;p[l]⑶=0;p[2][0]=l?650*sin(x[0]);p⑵[1]=-0.600*sin(x[l]);p[2][2]=0.800*sin(x[2]);p[2][3]=0;p[3][0]=l?650*cos(x[0]);p[3][l]=0?600*cos(x[
4、l]);p⑶[2]=-0.800*cos(x[2]);p[3][3]=0;returnp[i][j];}doubleG(doublea[mj[mj,intn,doubleb[mj)〃用高斯消去法求解線(xiàn)性方程組(系數(shù)矩陣為方陣){inti,j,k,il,jl;doubletemp;introw_maxmod;doubleelement_maxmod;for(j=0;j5、最大元索if(fabs(element_maxmod)6、p;}temp=b[j];b[j]=b[row_maxmod];b[row_maxmod]=temp;}for(k=j;kvm;k++)〃高斯消元a[jj[kj/=element_maxmod;b[jj/=element_maxmod;for(訂=j+1;il<4;il++){temp=a[il][j];for(jl=j;jl<4;jl++)aLilJ[jlJ-=a[jJ[jlJ:
7、ctemp;b[ilJ-=b[j]*temp;}}for(i=m-2;i>=0;i-)〃逆序求線(xiàn)性方程組的解for(
8、j=3;j>i;j-)b[i]-=a[i][j]*bU];returnb[n];doubleC(doublex[mj,doublev[mj,doublet2,intn)〃建立角加速度方程常數(shù)項(xiàng){doublep[m];p[0]=0?400*cos(t2*PI/180)+l?650*v[0]*v[0]*cos(x[0])+l?000*v[l]*v[l]*cos(x[l]);p[l]=0?400*sin(t2*PI/180)+1.650*v[0]*v[0]*sin(x[0])-l?000*v[l]*v[
9、l]*sin(x[l]);p[2]=0?400*cos(t2*PI/180)+l?650*v[0]*v[0]*cos(x[0])+0?600*v[l]*v[1]*cos(x[1])-0.800*v[2]*v[2]*cos(x[2]);p[3]=0?400*sin(t2*PI/180)+l?650*v[0]*v[0]*sin(x[0])-0?600*v[l]*v[l]*sin(x[l])-0?800*v[2]*v[2]*sin(x[2]);returnp[n];}intmain()i