高手请进,为什么我的迭代算法出了问题?

rmn 2004-02-23 10:25:03
Public Sub XYZ2BLH(ByVal x As Double, ByVal y As Double, ByVal z As Double, b As Double, l As Double, h As Double)
Dim A As Double, E2 As Double, N As Double
Const conZero = 0.000000001
Dim B0 As Double, preB0 As Double
A = conA80: E2 = conE2_80
l = Atn(y / x)
l = l * 180# / conPi + 180 'rad->d 若不加180为与真值互补的负值
'----------迭代算法求b,h
B0 = 0.1
'MsgBox B0

Open App.Path + "\debug.txt" For Append As #1
Write #1, B0
Do
preB0 = B0
N = A / Sqr(1 - E2 * Sin(B0) * Sin(B0))
h = z / Sin(B0) - N * (1 - E2)
B0 = Atn(z * (N + h) / Sqr((x * x + y * y) * (N * (1 - E2) + h)))
'Print B0
Write #1, B0

Loop While (Abs(B0 - preB0) > conZero)
Close #1
b = B0 '----
h = z / Sin(b) - N * (1 - E2)
b = b * 180 / conPi
'-----------
'MsgBox "BL:" + Str(b) + "|" + Str(l)
End Sub

问题:求得b为一固值大概为1.57弧度,即89.*度。
x,x,z变量可赋值例x=-2390290.3314,y=5389867.5787,z=2424507.8342

万分感谢!!
...全文
75 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

相关推荐
发帖
VB基础类
创建于2007-09-28

7492

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2004-02-23 10:25
社区公告
暂无公告