主题:【原创】[胖记原创]计算相关系数和标准偏差的两个小程序

浏览0 回复2 电梯直达
胖丁丁
结帖率:
100%
关注:0 |粉丝:0
新手级: 新兵
好多年前编的,可以在FOXPRO状态下运行, 能计算标准曲线和平行样在。。。还算方便。

因为是自己用,没有编界面,你们就凑合使使吧。。


*************第一个程序****
a=0
b=0
r=0

clear
wait ' 计算标准曲线'
? ''
inpu '        该曲线由几个点组成(1-10):'  to t
dimension tt(t),ts(t)
store 0.00 to ts
store 0.00 to tt

s=1
do while s<=t
@ 5+2*s,20 say '浓度第 '+alltrim(str(s))+'点:    ' get tt(s)
read
s=s+1
enddo
***********************************************************
x3=0
x23=0
y23=0
y3=0
xy3=0
clear
s=1
do while s<=t
@ 5+2*s,20 say '第 '+  alltrim(str(s)) +'点:  浓度'+str(tt(s))+  '    信号值 :' get ts(s)
* @ 5+2*s,20 say '浓度第 '+alltrim(str(s))+'点:    ' get tt(s)
read
y3=y3+ts(s)
x3=x3+tt(s)
xy3=xy3+ts(s)*tt(s)
x23=x23+tt(s)*tt(s)
y23=y23+ts(s)*ts(s)

s=s+1
enddo

*****************************************************
s=1
tttt=0
do while s<=t
a=a+tt(s)*tt(s)*y3
s=s+1
enddo

a=(a-x3*xy3)/(t*x23-x3*x3)
b=(t*xy3-x3*y3)/(t*x23-x3*x3)
r=(t*xy3-x3*y3)/(sqrt((t*x23-x3*x3)*(t*y23-y3*y3)))



? 'y=a+bX '
? 'a=: '+alltrim(str(a,15,6))
? 'b=: '+alltrim(str(b,15,6))
? 'r=: '+alltrim(str(r,15,6))

wait
retu


***----------第二个程序-------------------------------------------


clear
wait ' 计算平行样的标准偏差'
? ''
inpu '        输入几个点(1-10):'  to t
if t<=1
retu
endif

dimension tt(t)
store 0.0 to tt
ttt=0

s=1
do while s<=t
@ 5+2*s,20 say '第 '+alltrim(str(s))+'点:    ' get tt(s)
read
ttt=ttt+tt(s)
s=s+1
enddo

s=1
tttt=0
do while s<=t

tttt=tttt+(tt(s)-ttt/t)*(tt(s)-ttt/t)

s=s+1
enddo
a=sqrt(tttt/(t-1))
? '平均值: '+alltrim(str(ttt/t,20,5))
? '标准偏差: '+alltrim(str(a,20,5))
? '相对标准偏差: '+alltrim(str(100*a*t/ttt,20,7))+ ' %'
? '  '
? '  '
wait
retu
为您推荐
您可能想找: 气相色谱仪(GC) 询底价
专属顾问快速对接
立即提交
可能感兴趣
阿du
结帖率:
100%
关注:0 |粉丝:0
新手级: 新兵
瓦,FOXPRO早就忘光了
现在直接用EXCELL算不是很方便么?
胖丁丁
结帖率:
100%
关注:0 |粉丝:0
新手级: 新兵
一直用的是数据库,从DBASEII开始的,当时还是85年。。。习惯了,就什么统计都是自己建库。。

 所以,到了现在还是不会用EXCEL。。。自己也觉得好奇怪。。
猜你喜欢最新推荐热门推荐更多推荐
品牌合作伙伴