|
我想在现有的生产线弹簧受力程序中添加一段计算平均值的程序,原程序仅读取一个随机值然后输出。 1 W" S: x& p, n" R- ]8 P6 P因为弹簧受力有小幅度的震荡,所以我想让程序读取10个值,然后算出平均值输出。 4 ?' Y5 I2 R1 Y7 E. L+ l8 t- m关于提取测量数据计算平均值的程序,小弟实在是学得太少。。只会输入几个数求平均值的程序。 ) W1 L3 G% y6 U3 d5 S, c) |/ \! I下面这段是原程序,感谢进来帮忙的高手们!!, ?: D* z8 K& B- @ JU S_00; / / Wait for release 3 {4 x! h' s0 {' R6 C& pJU S_01; / / Read controller status and decide whether to start is needed. 9 v# N6 |+ _2 t( y# OJU S_02; / / Start CanOpenNode (if necessary) then return to Step 1. 6 q+ Y( W, k1 W/ oJU S_03; / / Reserve Step9 N) p6 u/ x' Z+ ^8 @ JU S_04; / / Read current position in increments / U! p+ k7 W5 \+ W9 _JU S_05; / / Read current limit set in mA / {/ `8 g& H WJU S_06; / / Read current flow in 1 / 1000 to current limit) ^) P, b7 q6 \. j6 Q4 u: A JU S_07; / / Read back; Y& r0 Z( l9 D, Z4 I# B! p8 a JU S_08; / ??/ Read back1 ^8 I+ A0 O7 y8 L8 g6 I- s+ i) w5 | JU S_09; / / Read back , {- m9 y4 G7 b! Z- s# AJU S_10; / / write the forward position 6 S: d7 B& w) a; m9 e" x# S# O2 m0 OJU S_11; / / Write back position2 z7 c. x, L+ ^& k JU S_12; / / Write Maximum Test Current ( D7 _9 @( q. i/ D( y' X- JJU S_13; / / write back3 H8 U, s" ]' z7 | JU S_14; / / write back' @# z) [4 D, D3 s JU S_15; / / write back- c0 ]$ w* V. E1 {9 @: P% T JU S_16; / / write back* c: `& |' z9 X) a2 i! d JU S_17; / / write back+ Q% e- V; E. p. ~
|
|