我想在現(xiàn)有的生產(chǎn)線彈簧受力程序中添加一段計算平均值的程序,原程序僅讀取一個隨機值然后輸出。; J9 ^7 M% ]) U7 F* N. h0 Y
因為彈簧受力有小幅度的震蕩,所以我想讓程序讀取10個值,然后算出平均值輸出。
% r1 Y7 i9 t# b2 l6 x7 ~+ F關(guān)于提取測量數(shù)據(jù)計算平均值的程序,小弟實在是學得太少。。只會輸入幾個數(shù)求平均值的程序。
- h7 |1 K9 a$ U! O下面這段是原程序,感謝進來幫忙的高手們!: d. z @7 {, O1 \0 H: A
JU S_00; / / Wait for release . f# p8 ] w( D/ ]5 x
JU S_01; / / Read controller status and decide whether to start is needed. 5 t2 T$ G" F: D' i, ~ d j
JU S_02; / / Start CanOpenNode (if necessary) then return to Step 1. , ^& u' j J; u
JU S_03; / / Reserve Step 5 { R, {7 M, ~& Y- H& U. H! ~& o
JU S_04; / / Read current position in increments
. p9 ?: H: z3 J7 ^9 a JU S_05; / / Read current limit set in mA . ]9 q% J8 l& X, a: H. W- B; v
JU S_06; / / Read current flow in 1 / 1000 to current limit 3 b7 a9 n+ o$ m* |2 x& Z
JU S_07; / / Read back 4 i" j: Y& [9 |8 Q# G$ G
JU S_08; / ??/ Read back - |% F4 p# E3 z, K# ?) E% r
JU S_09; / / Read back 7 ]# ?8 \0 v5 O
JU S_10; / / write the forward position
) D5 R8 |: Y" V9 H) \, U0 H JU S_11; / / Write back position ) [ G9 }( \" ?/ f
JU S_12; / / Write Maximum Test Current 0 N$ a% `+ A$ c2 x: V
JU S_13; / / write back
9 q o9 u" \9 A5 @! X JU S_14; / / write back
7 P' h$ H" y1 m" N# H: `$ N* O JU S_15; / / write back ; \! S" v5 R- y$ Y
JU S_16; / / write back + F& ?4 @) m- |4 g) P
JU S_17; / / write back * g* Q0 N4 `0 V3 U& y9 r
|