按一个按钮计算t值。
假设一组数据x=[
0.858056
0.829943
0.870514
0.839454
0.832522
0.810335
0.802828
0.237175
]
如何计算表达式t=均值/[标准差/(个数-1)]?然后在按钮旁的text中显示计算出的t?
用VB计算数,结果显示在另一个text框里
答案:2 悬赏:40 手机版
解决时间 2021-03-17 03:33
- 提问者网友:我是我
- 2021-03-16 07:08
最佳答案
- 五星知识达人网友:由着我着迷
- 2021-03-16 07:24
private sub command1_click()
dim t as single , tem as single , ave as single , d as single
for i = 1 to Ubound(x())
tem = tem + x(i)
next i
ave = tem / (Ubound(x()))'均值
tem = 0
for tx = 1 to Ubound(x())
tem = tem + (x(i) - ave)^2
next tx
d = tem / Ubound(x())'标准差
t = ave / (d / (Ubound(x()) - 1))
'text1.text = t 这里的text1可以是您的文本框的名称
end sub 得到的t即您所要的答案。
如果本次回答对您有帮助,请采纳以支持我们的发展,谢谢!!
dim t as single , tem as single , ave as single , d as single
for i = 1 to Ubound(x())
tem = tem + x(i)
next i
ave = tem / (Ubound(x()))'均值
tem = 0
for tx = 1 to Ubound(x())
tem = tem + (x(i) - ave)^2
next tx
d = tem / Ubound(x())'标准差
t = ave / (d / (Ubound(x()) - 1))
'text1.text = t 这里的text1可以是您的文本框的名称
end sub 得到的t即您所要的答案。
如果本次回答对您有帮助,请采纳以支持我们的发展,谢谢!!
全部回答
- 1楼网友:一把行者刀
- 2021-03-16 08:06
dim a as doubledim b as doubledim c as doubledim d as doubledim x1 as doulbedim x2 as doublea=value(text1.text)b=value(text1.text)c=value(text1.text)if b ^ 2 - 4 * a * c >= 0 thend = -b + sqr(b ^ 2 - 4 * a * c)x1 = d / (2 * a)label5.caption =cstr( x1)d = -b - sqr(b ^ 2 - 4 * a * c)x2 = d/ (2 * a)label7.caption = cst(x2)elselabel8.caption = "原方程无实数解"end if按照你的方法,虽然优点麻烦,但是容易看懂。
如果帮助到您,请记得采纳为满意答案哈,谢谢!祝您生活愉快! vae.la
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯