Лабораторный практикум № 4
Private Sub CommandButton1_Click()
Dim a(1 To 2,1 To 3) As Double
Dim b(1 To 3,1 To 4) As Double
Dim c(1 To 2,1 To 4) As Double
Range(''al:c2'').Select
Cells(4,1)=''Матрицa A''
For i=1To 2
For j=1To 3
a(i,j)=Selection.Cells(i,j).Value
Cells(i+4,j)=a(i,j)
Next j
Next I
Range(''eI:h3'').Select
Cells(4,5)=''Матрица B''
For i=1 To 3
For j=1 To 4
b(i,j)=Selection.Cells(i,j).Value
Cells(i+4,j+4)=b(i,j)
Next j
Next I
Cells(8,3)=''Матрица C''
Range(''E8:H9'').Select
Selection.FormulaArray =''=MMULT(A1:C2,E1:H3)''
Cells(11,1)=''Матрица Z''
Cells(11,6)=''Матрица Z трансп''
Range(''F12:H14'').Select
Selection.FormulaArray=''=TRANSPOSE(A12:C14)''
Cells(16,1)=''Матрица Z обр''
Range(''a17:c19'').Select
Selection.FormulaArray=''= minverSE(A12:C14)''
'c(1 To 2,1 To 4)=application.mmult(a( 1 To 2, 1 To 3):b(1 To 3,1 To 4))
'c=Application.MMult(a.b)
End Sub
Function Ed(al As Variant)As Variant
Ed=Application.MMult(Application.MInverse(al),al)
End Function
Function Kvadr_Forma(A As Variant,y As Variant)As Variant
s1=Application.Transpose(y)'Транспонирование Y
s2=Application.MMult(s1,A)'YT*A
s3= Application.Transpose (A)'Транспонирование A
s4= Application.MMult(s2,s3)'
s5= Application.MMult(s4,A)
s6= Application.MMult(s5,s3)
s7= Application.MMult(s6,y)
Kvadr_Forma=s7
Переглядів: 303 |