Moving Average - Sharp EL-9900 Handbook Vol. 2 Operation Manual

Graphing calculator programmes
Hide thumbs Also See for EL-9900 Handbook Vol. 2:
Table of Contents

Advertisement

Moving Average

Plot a moving average graph which helps to understand how the results change over a
specified period. The progress of sales and amounts of consumption and production can
also be seen.
Calculation
X
+ ... + X
i-(M-1) / 2
H
=
i
( I = 1 + M-1 , 2 + M-1 , ... , n + M-1 )
2
Start
Entry of number of divisions
Y
M>=n
N
Setting of calculation range
Calculation
Gosub count
Gosub MOVINGSUM
Y
M>=J
N
Gosub AVERAGE
Substitution
Gosub COUNT
Gosub MOVINGSUM
Y
(I+M)>J
N
Gosub AVERAGE
Display of line
K
Y
(n-int(M/2))
N
End
16
+ ... X
i
i+(M-1) / 2
M
2
2
FLOWCHART
MAIN
Enter unit for calculating average.
Returns to entry of no. of divisions if the number
of divisions more than no. of data.
Range for graph set.
I = 0, K = int (M/2)
First calculation. Jumps to subroutine.
LOOP1
Jumps to subroutine.
Number of calculation times of moving sum judged.
Repeated until calculation of no. of divisions performed.
LOOP2
X = K, Y = H
I = I + 1, J = I, S = 0
Jumps to
subroutine.
LOOP3
Jumps to
subroutine.
MOVINGSUM
Calculation of moving sum
Jumps to
subroutine.
Line displayed.
AVERAGE
Judgment of end.
Calculation of moving average
EL-9900 Graphing Calculator
H
: moving average
i
M : number of divisions
X
: data
i
n : number of data
Subroutine
COUNT
Setting of counter
Return
Subroutine
Calculation of
moving sum
Return
Subroutine
Calculation of
average
Return
PROGRAMME LIST
Title : MVIN AVG
Label MAIN
Print "Input DIVISION
Input D
D M
1_Stats L1
If M n Goto MAIN
Rem RANGE
(xmax-xmin)/10 Yscl
0
Xmin
n
Xmax
1
Xscl
xmin
Ymin
xmax
Ymax
0
I
int (M/2)
K
Gosub COUNT
Label LOOP1
Gosub MOVINGSUM
If M J Goto LOOP1
Gosub AVERAGE
Label LOOP2
K
X
H
Y
Gosub COUNT
Label LOOP3
Gosub MOVINGSUM
If (I+M)>J Goto LOOP3
Gosub AVERAGE
Line (X, Y, K, H)
If K (n-int (M/2))Goto LOOP2
Wait
End
Label COUNT
I+1 I
I
J
0
S
Return
Label MOVINGSUM
S+L1(J)
S
J+1 J
Return
Label AVERAGE
S/M
H
K+1
K
Return

Advertisement

Table of Contents
loading

Table of Contents