|
我想在现有的生产线弹簧受力程序中添加一段计算平均值的程序,原程序仅读取一个随机值然后输出。 5 U. c9 j# M0 s5 Q因为弹簧受力有小幅度的震荡,所以我想让程序读取10个值,然后算出平均值输出。" ?7 t& K2 L8 ~: j 关于提取测量数据计算平均值的程序,小弟实在是学得太少。。只会输入几个数求平均值的程序。: ]; s* \8 I: S3 W& c 下面这段是原程序,感谢进来帮忙的高手们!!, G9 i# w+ M- z9 @% {5 D JU S_00; / / Wait for release / |) A$ B7 ]1 Z6 w3 QJU S_01; / / Read controller status and decide whether to start is needed. ' _/ @9 z" O) [0 V# Y& S3 p8 C' NJU S_02; / / Start CanOpenNode (if necessary) then return to Step 1. 4 e- u( p4 Q3 @3 L0 LJU S_03; / / Reserve Step : i% o: z, Z4 Y1 G9 f+ Z; t5 aJU S_04; / / Read current position in increments & k7 P; q- ?* F3 _$ uJU S_05; / / Read current limit set in mA, s! R# t) P. y9 l) k; K! R0 F JU S_06; / / Read current flow in 1 / 1000 to current limit $ p9 T' o" H1 N6 ^3 c4 f* ~, Y$ [JU S_07; / / Read back @) M# ^% c0 {$ j) I) RJU S_08; / ??/ Read back7 Y- l. A7 K4 ]3 k0 w l( ? JU S_09; / / Read back& E1 n2 m, h6 r JU S_10; / / write the forward positionW# i% g( {) x1 | JU S_11; / / Write back position9 z$ L1 X3 E7 o3 [" Z7 C) z JU S_12; / / Write Maximum Test Current 1 M: W! j7 n% X* VJU S_13; / / write back $ S q3 e9 p2 ?6 @JU S_14; / / write back ' N j) N5 o# p) ?) CJU S_15; / / write back % w: k5 G2 s) r- q1 qJU S_16; / / write back" e( |) | H- A. L g6 h, @: `( S JU S_17; / / write back 0 X0 z( G& {; M. g! \ |
|