您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 人事档案/员工关系 > 计算机测绘程序设计代码
计算机测绘程序设计实验代码矩阵运算代码:OptionBase1Dima()AsDoubleDimb()AsDoubleDimc()AsDoublePrivateSubCommand1_Click()Dimn1AsIntegerDimm1AsIntegerDimn2AsIntegerDimm2AsIntegerDimmystring()AsStringDiml()AsStringmystring()=Split(Text1.Text,vbCrLf)m1=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)'第一行数据n1=UBound(l,1)-LBound(l,1)+1ReDima(m1,n1)Fori=1Tom1l()=Split(mystring(i-1),)n1=UBound(l,1)-LBound(l,1)+1Forj=1Ton1a(i,j)=l(j-1)NextjNexti'Dimmystring()AsString'Diml()AsStringmystring()=Split(Text2.Text,vbCrLf)m1=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)'第一行数据n1=UBound(l,1)-LBound(l,1)+1ReDimb(m1,n1)Fori=1Tom1l()=Split(mystring(i-1),)n1=UBound(l,1)-LBound(l,1)+1Forj=1Ton1b(i,j)=l(j-1)NextjNextiReDimc(m1,n1)Callmadd(a,b,c)Text3.Text=Fori=1Tom1Forj=1Ton1Text3.Text=Text3.Text+Str(c(i,j))+NextjText3.Text=Text3.Text+vbCrLfNextiEndSubSubmadd(mtxA()AsDouble,mtxB()AsDouble,mtxC()AsDouble)'矩阵相加DimiAsInteger,jAsIntegerDimmAsInteger,nAsIntegerm=UBound(mtxA,1)-LBound(mtxA,1)+1n=UBound(mtxA,2)-LBound(mtxA,2)+1Fori=1TonForj=1TommtxC(i,j)=mtxA(i,j)+mtxB(i,j)Text3.Text=mtxC(i,j)NextjNextiEndSub角度与弧度的相互转换代码:PublicFunctionjdzh#(jd#,Optionalsrdw%=0,Optionalscdw%=0)Constpi#=3.14159265358979Dimd%,f%,m#,fh%fh=Sgn(jd)jd=Abs(jd)SelectCasesrdwCase0d=Int(jd)f=Int((jd-d)*100)m=((jd-d)*100-f)*100jdzh=d+f/60+m/3600Case1jdzh=jdCaseElsejdzh=jd*180/piEndSelectSelectCasescdwCase0jdzh=jdzh*pi/180*fhCase1jdzh=jdzh*fhCase2jdzh=jdzh*60*fhCase3jdzh=jdzh*3600*fhCaseElsed=Int(jdzh)f=Int((jdzh-d)*60)m=((jdzh-d)*60-f)*60jdzh=d+f/100+m/10000*fhEndSelectEndFunction矩阵:OptionBase1DimA()AsDoubleDimB()AsDoubleDimC()AsDoublePrivateSubCommand1_Click()Text3.Text=DimiAsIntegerDimjAsIntegerDimn1AsIntegerDimm1AsIntegerDimn2AsIntegerDimm2AsIntegerDimmystring()AsStringDiml()AsStringmystring()=Split(Text1.Text,vbCrLf)n1=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m1=UBound(l,1)-LBound(l,1)+1ReDimA(n1,m1)Fori=1Ton1l()=Split(mystring(i-1),)Forj=1Tom1A(i,j)=l(j-1)NextjNextimystring()=Split(Text2.Text,vbCrLf)n2=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m2=UBound(l,1)-LBound(l,1)+1ReDimB(n2,m2)Fori=1Ton2l()=Split(mystring(i-1),)Forj=1Tom2B(i,j)=l(j-1)NextjNextiReDimC(n1,m1)Callmadd(A,B,C)Fori=1Ton2Forj=1Tom2Text3.Text=Text3.Text+Str(C(i,j))+NextjText3.Text=Text3.Text+vbCrLfNextiEndSubPrivateSubCommand2_Click()Text3.Text=Dimmystring()AsStringDiml()AsStringmystring()=Split(Text1.Text,vbCrLf)n1=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m1=UBound(l,1)-LBound(l,1)+1ReDimA(n1,m1)Fori=1Ton1l()=Split(mystring(i-1),)Forj=1Tom1A(i,j)=l(j-1)NextjNextimystring()=Split(Text2.Text,vbCrLf)n2=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m2=UBound(l,1)-LBound(l,1)+1ReDimB(n2,m2)Fori=1Ton2l()=Split(mystring(i-1),)Forj=1Tom2B(i,j)=l(j-1)NextjNextiReDimC(n1,m1)Callmcut(A,B,C)Fori=1Ton2Forj=1Tom2Text3.Text=Text3.Text+Str(C(i,j))+NextjText3.Text=Text3.Text+vbCrLfNextiEndSubPrivateSubCommand3_Click()Text3.Text=Dimmystring()AsStringDiml()AsStringmystring()=Split(Text1.Text,vbCrLf)n1=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m1=UBound(l,1)-LBound(l,1)+1ReDimA(n1,m1)Fori=1Ton1l()=Split(mystring(i-1),)Forj=1Tom1A(i,j)=l(j-1)NextjNextimystring()=Split(Text2.Text,vbCrLf)n2=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m2=UBound(l,1)-LBound(l,1)+1ReDimB(n2,m2)Fori=1Ton2l()=Split(mystring(i-1),)Forj=1Tom2B(i,j)=l(j-1)NextjNextiReDimC(n1,m1)Callmmul(A,B,C)Fori=1Ton2Forj=1Tom2Text3.Text=Text3.Text+Str(C(i,j))+NextjText3.Text=Text3.Text+vbCrLfNextiEndSubPrivateSubCommand4_Click()Text3.Text=Dimmystring()AsStringDiml()AsStringmystring()=Split(Text1.Text,vbCrLf)n1=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m1=UBound(l,1)-LBound(l,1)+1ReDimA(n1,m1)Fori=1Ton1l()=Split(mystring(i-1),)Forj=1Tom1A(i,j)=l(j-1)NextjNextiReDimC(n1,m1)CallMRinv(A)Fori=1Ton1Forj=1Tom1Text3.Text=Text3.Text+Str(Format(A(i,j),0.0000))+NextjText3.Text=Text3.Text+vbCrLfNextiEndSubPrivateSubCommand5_Click()Text3.Text=DimAT()AsDoubleDimmystring()AsStringDiml()AsStringmystring()=Split(Text1.Text,vbCrLf)n1=UBound(mystring,1)-LBound(mystring,1)l()=Split(mystring(0),)m1=UBound(l,1)-LBound(l,1)+1ReDimA(n1,m1)Fori=1Ton1l()=Split(mystring(i-1),)Forj=1Tom1A(i,j)=l(j-1)NextjNextiReDimAT(m1,n1)CallMtrans(A,AT)Fori=1Ton1Forj=1Tom1Text3.Text=Text3.Text+Str(Format(AT(i,j),0.0000))+NextjText3.Text=Text3.Text+vbCrLfNextiEndSubSubmadd(mtxA()AsDouble,mtxB()AsDouble,mtxC()AsDouble)'矩阵相加DimiAsInteger,jAsIntegerDimmAsInteger,nAsIntegerm=UBound(mtxA,1)-LBound(mtxA,1)+1n=UBound(mtxA,2)-LBound(mtxA,2)+1Fori=1TonForj=1TommtxC(i,j)=mtxA(i,j)+mtxB(i,j)NextjNextiEndSubSubmcut(mtxA()AsDouble,mtxB()AsDouble,mtxC()AsDouble)'矩阵相减DimiAsInteger,jAsIntegerDimmAsInteger,nAsIntegerm=UBound(mtxA,1)-LBound(mtxA,1)+1n=UBound(mtxA,2)-LBound(mtxA,2)+1Fori=1TonForj=1TommtxC(i,j)=mtxA(i,j)-mtxB(i,j)NextjNextiEndSubSubMtrans(mtxA()AsDouble,mtxAT()AsDouble)'矩阵转置DimiAsInteger,jAsIntegerDimmAsInteger,nAsIntegerm=UBound(mtxA,1)-LBound(mtxA,1)+1n=UBound(mtxA,2)-LBou
本文标题:计算机测绘程序设计代码
链接地址:https://www.777doc.com/doc-2043460 .html