Examples

The following script demonstrates how you can use the `FILTER` command to smooth data. See Figure 1.

     X=[0:4:.05]
     Y=X^2-3*X+3+SIN(X*3)*RAN(X)*2
     WINDOW 5
     GRAPH\AXESONLY X Y
     GET XMIN XMIN
     GET XMAX XMAX
     GET YMIN YMIN
     GET YMAX YMAX
     SCALES XMIN XMAX YMIN YMAX
     SET PLOTSYMBOL -1
     GRAPH\OVERLAY X Y
     SET PLOTSYMBOL 0
     WINDOW 6
     FILTER\-RECURSIVE Y YF [-36;9;44;69;84;89;84;69;44;9;-36]
     SCALES XMIN XMAX YMIN YMAX
     GRAPH X YF/429
     WINDOW 7
     FILTER\-RECURSIVE Y YF [18;-45;-10;60;120;143;120;60;-10;-45;18]
     SCALES XMIN XMAX YMIN YMAX
     GRAPH X YF/429
     WINDOW 8
     FILTER\-RECURSIVE Y YF [-3;-6;-5;3;21;46;67;74;67;46;21;3;-5;-6;-3]
     SCALES XMIN XMAX YMIN YMAX
     GRAPH X YF/320

Fig. 1: A `FILTER` example showing data smoothing

The following script demonstrates how you can use the `FILTER` command to differentiate data. See Figure 2.

     X=[0:4:.2]
     H=X[2]-X[1]
     Y=X^2-3*X+3
     WINDOW 5
     SET PLOTSYMBOL -1
     GRAPH X Y
     WINDOW 7
     SET PLOTSYMBOL 0
     FILTER\-RECURSIVE Y YF [-4;30;-120;40;60;-6]
     SCALES 0 4 -3 5
     SET PLOTSYMBOL -2
     GRAPH X YF/(120*H)
     SET PLOTSYMBOL 0
     GRAPH\OVERLAY X 2*X-3

Fig. 2: A `FILTER` example showing the first derivative

Recursive filters