| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 541 人关注过本帖
标题:帮忙翻译一段vb的代码,翻译成delphi的,是关于双曲线模型预测
只看楼主 加入收藏
yewang1122
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-5-12
收藏
 问题点数:0 回复次数:0 
帮忙翻译一段vb的代码,翻译成delphi的,是关于双曲线模型预测
Dim HTdata8(2, 10000) As Double
Dim Htdata9(2, 10000) As Double
Dim Ti As Double
Dim DATASTRING As String
Dim Gongdian As String
Dim k8 As Integer

;读入数据文件
k8 = 1
Open "AX.DAT" For Input As #18
Do Until EOF(18)
  Line Input #18, DATASTRING
  HTdata8(1, k8) = Val(Left(DATASTRING, 8))
  HTdata8(2, k8) = Val(Mid$(DATASTRING, 9, 8))
  k8 = k8 + 1
 
 If k8 > 10000 Then Exit Do
Loop
Close #18

;数据处理
k8 = k8 - 1
For i = 2 To k8
 Htdata9(1, i) = HTdata8(1, i) - HTdata8(1, 1)
 Htdata9(2, i) = (HTdata8(1, i) - HTdata8(1, 1)) / (HTdata8(2, i) - HTdata8(2, 1))
Next i

Htdata9(1, 1) = 0
Htdata9(2, 1) = 0
For i = 2 To k8
 Htdata9(1, 1) = Htdata9(1, 1) + Htdata9(1, i)
Htdata9(2, 1) = Htdata9(2, 1) + Htdata9(2, i)
Next i
Htdata9(1, 1) = Htdata9(1, 1) / (k8 - 1)
Htdata9(2, 1) = Htdata9(2, 1) / (k8 - 1)

ht1 = 0
ht2 = 0
For i = 2 To k8
 ht1 = ht1 + (Htdata9(1, i) - Htdata9(1, 1)) * (Htdata9(2, i) - Htdata9(2, 1))
ht2 = ht2 + (Htdata9(1, i) - Htdata9(1, 1)) * (Htdata9(1, i) - Htdata9(1, 1))
Next i

;求待定参数
BB = ht1 / ht2
AA = Htdata9(2, 1) - BB * Htdata9(1, 1)

;输出参数至输出文件
Open "双曲线模型.DAT" For Output As #1
   Write #1, HTdata8(1, 1)
   Write #1, HTdata8(2, 1)
   Write #1, AA
Write #1, BB
Close #1

r = MsgBox("计算完成,结果请查询“双曲线模型.dat” ", vbOKOnly)
End
搜索更多相关主题的帖子: 双曲线 翻译 10000 
2012-05-26 15:21
快速回复:帮忙翻译一段vb的代码,翻译成delphi的,是关于双曲线模型预测
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033851 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved