请帮忙翻译一下这段代码:Dim a() As String, b() As String, x1() As String, y1() As String
Dima()AsString,b()AsString,x1()AsString,y1()AsStringPrivateSubCommand1_Click()IfLen(T...
Dim a() As String, b() As String, x1() As String, y1() As String
Private Sub Command1_Click()
If Len(Text1) = 0 Or Len(Text2) = 0 Then
MsgBox "请输入变量符号!", vbExclamation
Exit Sub
End If
If Len(Text3) = 0 Or Len(Text4) = 0 Then
MsgBox "请输入参数!", vbExclamation
Exit Sub
End If
m$ = Text1.Text
n$ = Text2.Text
y = Text3.Text
b() = Split(y)
x = Text4.Text
a() = Split(x)
n1 = UBound(a)
m1 = UBound(b)
If n1 <> m1 Then
MsgBox "自变量和因变量的个数不等!", vbExclamation
Exit Sub
End If
ReDim x1(n1)
ReDim y1(m1)
For i = 0 To n1
x1(i) = Val(a(i))
Next i
For j = o To m1
y1(j) = Val(b(j))
Next j
For i = 0 To m1
xx = xx + x1(i): yy = yy + y1(i)
X2 = X2 + x1(i) * x1(i): Y2 = Y2 + y1(i) * y1(i)
xy = xy + x1(i) * y1(i)
Next i
bb = ((m1 + l) * xy - xx * yy) / ((m1 + l) * X2 - xx ^ 2)
bb = Int(bb * 10000) / 10000
aa = (yy - bb * xx) / (m1 + 1)
aa = Int(aa * 10000) / 10000
Text5.Text = m$ & "=" & Str(aa) & "+" & Str(bb) & n$
End Sub 展开
Private Sub Command1_Click()
If Len(Text1) = 0 Or Len(Text2) = 0 Then
MsgBox "请输入变量符号!", vbExclamation
Exit Sub
End If
If Len(Text3) = 0 Or Len(Text4) = 0 Then
MsgBox "请输入参数!", vbExclamation
Exit Sub
End If
m$ = Text1.Text
n$ = Text2.Text
y = Text3.Text
b() = Split(y)
x = Text4.Text
a() = Split(x)
n1 = UBound(a)
m1 = UBound(b)
If n1 <> m1 Then
MsgBox "自变量和因变量的个数不等!", vbExclamation
Exit Sub
End If
ReDim x1(n1)
ReDim y1(m1)
For i = 0 To n1
x1(i) = Val(a(i))
Next i
For j = o To m1
y1(j) = Val(b(j))
Next j
For i = 0 To m1
xx = xx + x1(i): yy = yy + y1(i)
X2 = X2 + x1(i) * x1(i): Y2 = Y2 + y1(i) * y1(i)
xy = xy + x1(i) * y1(i)
Next i
bb = ((m1 + l) * xy - xx * yy) / ((m1 + l) * X2 - xx ^ 2)
bb = Int(bb * 10000) / 10000
aa = (yy - bb * xx) / (m1 + 1)
aa = Int(aa * 10000) / 10000
Text5.Text = m$ & "=" & Str(aa) & "+" & Str(bb) & n$
End Sub 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询