请教高手!!!如何 把读取的10个数据直接计算出平均值
我想在现有的生产线弹簧受力程序中添加一段计算平均值的程序,原程序仅读取一个随机值然后输出。因为弹簧受力有小幅度的震荡,所以我想让程序读取10个值,然后算出平均值输出。
关于提取测量数据计算平均值的程序,小弟实在是学得太少。。只会输入几个数求平均值的程序。
下面这段是原程序,感谢进来帮忙的高手们!!
JU S_00; / / Wait for release
JU S_01; / / Read controller status and decide whether to start is needed.
JU S_02; / / Start CanOpenNode (if necessary) then return to Step 1.
JU S_03; / / Reserve Step
JU S_04; / / Read current position in increments
JU S_05; / / Read current limit set in mA
JU S_06; / / Read current flow in 1 / 1000 to current limit
JU S_07; / / Read back
JU S_08; / ??/ Read back
JU S_09; / / Read back
JU S_10; / / write the forward position
JU S_11; / / Write back position
JU S_12; / / Write Maximum Test Current
JU S_13; / / write back
JU S_14; / / write back
JU S_15; / / write back
JU S_16; / / write back
JU S_17; / / write back