导航:首页 > 编程语言 > vb编程矩阵乘法

vb编程矩阵乘法

发布时间:2023-05-07 14:40:23

⑴ VB矩阵乘法的问题

1、ReDim g(7, 8), a(7, 8), c(7, 8)
将把这3个数组的值悄数银全部赋值为零。毕枯
2、g(i, j) = -a(i, k3) * c(k3, j)
这个不是矩阵运启宴算相乘的运算。
矩阵相乘的运算是:g(i, j) =g(i, j)+a(i, k3) * c(k3, j)

⑵ VB中怎样实现计算自定义的1*5与5*5矩阵相乘

Dim CS() As Variant
Dim A(5) As Single
Dim B(5, 5) As Single
Dim C(5) As Single
Dim I As Integer, J As Integer

Private Sub Form_Click()
Form1.AutoRedraw = True
Form1.Cls
Print "A矩阵:"
For I = 1 To 5
A(I) = CS(I - 1)
If A(I) > 0 And A(I) < 1 Then
Print Format(A(I), "0.##");
Else
Print A(I);
End If
Print " ";
Next
Print
Print "B矩阵:"
For I = 1 To 5
For J = 1 To 5
B(I, J) = I - J
B(I, J) = Val(InputBox("第" & I & "行神蠢宴第" & J & "个元素"档乎, "输入B矩阵", B(I, J)))
Print B(I, J);
Next
Print
Next
Print "C(=A*B)矩阵:"
For I = 1 To 5
For J = 1 To 5
C(I) = C(I) + A(J) * B(J, I)
Next
If Abs(C(I)) > 0 And Abs(C(I)) < 1 Then
Print " "; Format(C(I), "0.##"游银); " ";
Else
Print C(I);
End If
Next
Print
End Sub

Private Sub Form_Load()
CS = Array(0.3, 0.32, 0.25, 0.07, 0.05)
End Sub

如有其他要求,请留言!

⑶ vb 矩阵乘法运算

Option Explicit
Dim a() As Integer
Dim b() As Integer
Dim d As Integer
Dim m As Integer
Dim n As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer
d = InputBox("请输判碧入A矩阵行数", "提示")
n = InputBox("请输入A矩阵列数", "提示")
ReDim a(d, n) As Integer
For i = 1 To d
For j = 1 To n
a(i, j) = InputBox("请输入矩阵A", "提示")
Picture1.Print a(i, j);
Next j
Picture1.Print
Next i
Picture1.Print
End Sub
'矩阵B输入程序
Private Sub Command2_Click()
Dim c As Integer
Dim i As Integer, j As Integer
c = InputBox("请输入B矩阵行肆行数", "裂冲哗提示")

⑷ 矩阵相乘 VB代码

'建立4个label1(),index 0--3。6个label2(),index 0--5。6个text1(),index 0--5
'侍旦建立1个label3,两个command1和2
'Form1.MaxButton = False

Dim I As Byte, J As Byte, A As Byte, B As Byte
Dim M As Byte, N As Byte, MN As Byte
Dim JZ1() As Single, JZ2() As Single, JZ3() As Single
Dim SS As String

Private Sub Command1_Click()
If Command1.Caption = "确定" Then
Command1.Caption = "完成"
ReDim JZ1(1 To M, 1 To MN) As Single
ReDim JZ2(1 To MN, 1 To N) As Single
ReDim JZ3(1 To M, 1 To N) As Single
For I = 0 To 5
Text1(I).Locked = True
Text1(I).BackColor = &HF0F0F0
Text1(I).BorderStyle = 0
Next I
Label3.Caption = "请输入相乘的两个矩阵,输入完成后按<完成>键"
For I = 1 To M
For J = 1 To MN
JZ1(I, J) = Val(InputBox("第一个矩阵____第" + Str(I) + "行 第" + Str(J) + "列元素:", "输入矩阵"空弊, 3))
CurrentX = 100 + (J - 1) * 350
CurrentY = 1000 + (I - 1) * 200
Print JZ1(I, J)
Next
Next
For I = 1 To MN
For J = 1 To N
JZ2(I, J) = Val(InputBox("斗谈族第二个矩阵____第" + Str(I) + "行 第" + Str(J) + "列元素:", "输入矩阵", 3))
CurrentX = 3000 + (J - 1) * 350
CurrentY = 1000 + (I - 1) * 200
Print JZ2(I, J)
Next
Next
'Select Case M
ElseIf Command1.Caption = "完成" Then
Command1.Caption = "重新开始"
For I = 1 To M
For J = 1 To N
JZ3(I, J) = 0
For A = 1 To MN
JZ3(I, J) = JZ3(I, J) + JZ1(I, A) * JZ2(A, J)
Next
CurrentX = 6000 + (J - 1) * 350
CurrentY = 1000 + (I - 1) * 200
Print JZ3(I, J)
Next
Next
Else
Form_Load
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Cls
Form1.Width = 9000
Form1.Height = 7000

For I = 0 To 2
Label1(I).Width = 1000
Label1(I).Height = 200
Label1(I).Top = 0
Label1(I).Left = 700 + I * 3000
Label1(I).Caption = "第" + Str(I + 1) + "个矩阵"
Next
For I = 0 To 5
Text1(I).Width = 400
Text1(I).Height = 200
Text1(I).Top = 300
Label2(I).Width = 200
Label2(I).Height = Text1(I).Height
Label2(I).Top = Text1(I).Top + 50
Text1(I).Text = 2
Text1(I).Alignment = 1
If I Mod 2 Then
Text1(I).Left = I * 1500 - 300
Label2(I).Caption = "列"
Else
Text1(I).Left = 300 + I * 1500
Label2(I).Caption = "行"
End If
Label2(I).Left = Text1(I).Left + 450
Next
M = 2
N = 2
MN = 2
Text1(2).Locked = True
Text1(4).Locked = True
Text1(5).Locked = True
Text1(0).Locked = False
Text1(1).Locked = False
Text1(3).Locked = False
For I = 0 To 5
Text1(I).BackColor = &HFFFFFF
Text1(I).BorderStyle = 1
Next I
Command1.Caption = "确定"
Command2.Caption = "退出"
Label3.Caption = "请输入矩阵的行和列,完成后按<确定>键"
End Sub
Private Sub Text1_Change(Index As Integer)
Text1(2).Text = Text1(1).Text
Text1(4).Text = Text1(0).Text
Text1(5).Text = Text1(3).Text
M = Val(Text1(0).Text)
MN = Val(Text1(1).Text)
N = Val(Text1(3).Text)
End Sub
已经运行过。

⑸ VB 矩阵乘法提示下标越界

你贴的代码不完整啊

⑹ VBA矩阵乘法

这个不用自己禅空陆亏扮写那么麻烦把 有个内置函数贺顷MMULT 就是算 矩阵乘法的!

如果要在VBA 里面调用,阔以用
application.worksheetfunction.mmult() 调用

阅读全文

与vb编程矩阵乘法相关的资料

热点内容
自家wifi怎么能加密 浏览:642
红米k40加密门禁卡 浏览:845
什么样的源码好看 浏览:156
手机主服务器有什么用 浏览:610
程序编写命令 浏览:597
android发送心跳包 浏览:385
指标源码和原理 浏览:700
汽车空调压缩吸盘 浏览:208
崽崽因app版本不同不能邀请怎么办 浏览:686
poa算法得到的解为全局最优解 浏览:926
python符号表达式 浏览:34
威驰压缩机继电器 浏览:871
华为手机怎么设置移动数据app 浏览:959
空调压缩机哪的厂家多 浏览:390
手指速算法24加7怎么算 浏览:139
如何用python写vlookup函数 浏览:798
社保加密狗厂商 浏览:216
php编译运行说法 浏览:957
程序员说喂 浏览:258
抖音直播云服务器 浏览:629