用VB解一个6x6的线性方程组,已知6x7的增广矩阵。急急急啊,请高手解答,在线等!!! 70
1个回答
展开全部
新建一个工程,添加一个CommandButton(Command1),双好雀击这个歼稿CommandButton,代码如下友改早:
Private Sub Command1_Click()
Dim a(1 To 6, 1 To 7) As Double
Dim x(1 To 6) As Double
Dim Sum As Double
Dim n As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer, m As Integer
n = 6
For i = 1 To n
For j = 1 To n + 1
a(i, j) = Val(InputBox(" 输入增广矩阵:a" & "(" & i & "," & j & ")" ))
Next j
Next i
'Next m
For i = 1 To n
For j = 1 To n + 1
Print a(i, j);
Next j
Print
Next i
‘============消元过程===============
For k = 1 To n - 1
For i = k + 1 To n
For j = k + 1 To n + 1
a(i, j) = a(i, j) - a(i, k) * a(k, j) / a(k, k)
Next j
Next i
Next k
'============ 回代过程===============
x(n) = a(n, n + 1) / a(n, n)
Print "x"; n; "="; x(k);
Print
For k = n - 1 To 1 Step -1
Sum = 0
For j = k + 1 To n
Sum = a(k, j) * x(j) + Sum
Next j
x(k) = (a(k, n + 1) - Sum) / a(k, k)
Print "x"; k; "="; x(k);
Print
Next k
End Sub
Private Sub Command1_Click()
Dim a(1 To 6, 1 To 7) As Double
Dim x(1 To 6) As Double
Dim Sum As Double
Dim n As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer, m As Integer
n = 6
For i = 1 To n
For j = 1 To n + 1
a(i, j) = Val(InputBox(" 输入增广矩阵:a" & "(" & i & "," & j & ")" ))
Next j
Next i
'Next m
For i = 1 To n
For j = 1 To n + 1
Print a(i, j);
Next j
Next i
‘============消元过程===============
For k = 1 To n - 1
For i = k + 1 To n
For j = k + 1 To n + 1
a(i, j) = a(i, j) - a(i, k) * a(k, j) / a(k, k)
Next j
Next i
Next k
'============ 回代过程===============
x(n) = a(n, n + 1) / a(n, n)
Print "x"; n; "="; x(k);
For k = n - 1 To 1 Step -1
Sum = 0
For j = k + 1 To n
Sum = a(k, j) * x(j) + Sum
Next j
x(k) = (a(k, n + 1) - Sum) / a(k, k)
Print "x"; k; "="; x(k);
Next k
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
Sievers分析仪
2024-10-13 广告
2024-10-13 广告
是的。传统上,对于符合要求的内毒素检测,最终用户必须从标准内毒素库存瓶中构建至少一式两份三点标准曲线;必须有重复的阴性控制;每个样品和PPC必须一式两份。有了Sievers Eclipse内毒素检测仪,这些步骤可以通过使用预嵌入的内毒素标准...
点击进入详情页
本回答由Sievers分析仪提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询