仪器信息网APP
选仪器、听讲座、看资讯

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

数据处理

  • 好多年前编的,可以在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
    +关注 私聊
  • 阿du

    第1楼2008/05/29

    瓦,FOXPRO早就忘光了
    现在直接用EXCELL算不是很方便么?

0
    +关注 私聊
  • 胖丁丁

    第2楼2008/05/30

    一直用的是数据库,从DBASEII开始的,当时还是85年。。。习惯了,就什么统计都是自己建库。。

     所以,到了现在还是不会用EXCEL。。。自己也觉得好奇怪。。

0
举报帖子

执行举报

点赞用户
好友列表
加载中...
正在为您切换请稍后...