迭代出计算,求大神来捉虫
采用迭代法,使等式两边的绝对值差小于等于0.0001
已知条件:
α为角度
c为变形系数
fm曲率比
Fa为轴向力
Z钢球数量
Dw为钢球直径
未知量α'进行迭代VB中x1表示
要求:输入已知条件和代入一个α',最终求出/显示等式的两边数值和最终的α'
Private Sub Command1_Click()
Dim α As Single
Dim x1 As Single
Dim c As Single
Dim fm As Single
Dim Fa As Single
Dim Z As Single
Dim Dw As Single
Const PI = 3.14159
Dim y1 As Single
Dim y2 As Single
α = Val(Text1.Text)
x1 = Val(Text2.Text)
c = Val(Text3.Text)
fm = Val(Text4.Text)
Fa = Val(Text5.Text)
Z = Val(Text6.Text)
Dw = Val(Text7.Text)
For i = 0 To 90 Step 0.01
y1 = Cos(α * PI / 180) / Cos(x1 * PI / 180)
y2 = 1 + c / (2 * fm - 1) * (Fa / (Z * Dw * Dw * Sin(x1 * PI / 180))) ^ (2 / 3)
If Abs(Cos(α * PI / 180) / Cos(x1 * PI / 180) - (1 + c / (2 * fm - 1) * (Fa / (Z * Dw * Dw * Sin(x1 * PI / 180))) ^ (2 / 3))) < 0.0001 Then
Text8.Text = Round(Val(y1), 4)
Text9.Text = Round(Val(y2), 4)
Text10.Text = Round(Val(x1), 2)
End If
x1 = x1 + i
Next i
End Sub
菜鸟跪求大神