1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
<HTML>
<HEAD>
<TITLE>Examples</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<font size="+2" color="green">Examples</font></P>
<P>
The following script demonstrates how you can use the
<CODE>FILTER</CODE> command to smooth data. See Figure 1.</P>
<P>
<font color="blue"><pre>
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
</pre></font></P>
<P>
<center><b>Fig. 1: A <CODE>FILTER</CODE> example showing data smoothing</b>
<img src="smoothingFilter.jpg"></center></P>
<P>
The following script demonstrates how you can use the
<CODE>FILTER</CODE> command to differentiate data. See Figure 2.</P>
<P>
<font color="blue"><pre>
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
</pre></font></P>
<P>
<center><b>Fig. 2: A <CODE>FILTER</CODE> example showing the first derivative</b>
<img src="derivFilter.jpg"></center></P>
<P>
<a href="recursive.htm"><img src="../shadow_left.gif">
<font size="+1" color="olive">Recursive filters</font></a></P>
</BODY>
</HTML>
|