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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
<HTML>
<HEAD>
<TITLE>Smoothing</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF" fgcolor="#000000">
<P>
<font size="+3" color="green"><B>Smoothing</B></font></P>
<P>
<TABLE border="1" cols="2" frame="box" rules="all" width="572">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%"><CODE>
vout = SMOOTH(x,y,xout)<br />
vout = SMOOTH(x,y,xout,w)<br />
mout = SPLSMOOTH(x,y,n)<br />
mout = SPLSMOOTH(x,y,n,w)<br />
mout = BIVSMOOTH(x,y,z,mx,my)</CODE>
</TD></TR>
<TR>
<TD width="15%" valign="top"><B>Defaults</B>:</TD>
<TD width="85%"><CODE>
w[1:#] = 1</CODE>
</TD></TR>
</table></p>
<p>
Smoothing means that the output may not pass through the original data. If it is important that the curve
pass through the original data, use
the <CODE><a href="../Interpolate/interpolate.htm">INTERPOLATE</a></CODE> function,
unless your independent variable is not monotonically increasing. In that case, use
the <CODE><a href="../Interpolate/splinterp.htm">SPLINTERP</a></CODE> function.
For 2D interpolation, use the
<CODE><a href="../Interpolate/bivinterp.htm">BIVINTERP</a></CODE> function.</P>
<p>
The <CODE>SMOOTH</CODE> function calculates a smooth curve using the method of cubic
splines under tension. The data is contained in vectors <CODE>x</CODE>, the
independent variable, and <CODE>y</CODE>, the dependent variable. A vector is
returned with the same length as <CODE>xout</CODE>, the output locations
vector. Vectors <CODE>x</CODE> and <CODE>xout</CODE> must
be strictly monotonically increasing, with <CODE>x[1] ≤ xout[j] ≤ x[#]</CODE>
for <CODE>j=1,2,...,LEN(xout)</CODE></p>
<p>
<font size="+1" color="green">SPLSMOOTH function</font></p>
<p>
The <CODE>SPLSMOOTH</CODE> function calculates a smooth curve through the data
contained in <CODE>x</CODE>, the independent variable,
and <CODE>y</CODE>, the dependent variable. <CODE>x</CODE>
need not be increasing. The number of output locations is given in
scalar <CODE>n</CODE>. The output of this function is a matrix
with <CODE>n</CODE> rows and <code>2</code> columns. The first column will contain
the output locations and the second column the smoothed values.</p>
<p>
The points are first parameterized in terms of normalized arc length. The normalized length
of <CODE>x</CODE> is the real length divided by the range
of <CODE>x</CODE>, that is, the maximum value minus the minimum value. The arc
length at a point is approximated by the sum of the lengths of straight line segments connecting
all points up to that point. A spline under tension is calculated for <CODE>x</CODE> versus arc
length and <CODE>y</CODE> versus arc
length. The <CODE>x</CODE> and <CODE>y</CODE> values are
interpolated separately and then combined to form the output interpolant.</p>
<P>
<font size="+1" color="green">Weights</font></p>
<p>
If no weights, <CODE><font color="blue">w</font></CODE>, are entered, the weight at each data point defaults
to <CODE>1</CODE>. The weights control the amount of smoothing at each data point. As the weight at a point
decreases, the spline fits that data point more closely.</P>
<p>
<font size="+1" color="green">Spline tension</font></P>
<p>
Depending on the tension, the smoothed curve may not pass through the original data points. The tension
corresponds to the curviness, and must be > <CODE>0</CODE>. As the tension decreases, the amount of
smoothing decreases and the data points are fit more exactly. If it is close to zero, each
smoothing function is almost a cubic spline and the resulting curve is quite loose. As the tension
increases, the fit straightens and has less curvature at peaks, valleys and endpoints. If the tension
is large, the smoothing is almost linear and the result approaches the least-squares line through the
data. The default value for the tension is zero, and the tension is controlled with
the <CODE><a href="../../../Characteristics/GeneralGraph/tension/tension.htm">TENSION</a></CODE>
characteristic.</P>
<p>
<font size="+1" color="green">Method</font></P>
<p>
Given a set of abscissae: <img src="image1.png">, a cubic spline function over the
region <img src="image2.png"> is composed of cubic parabolas</p>
<p>
<center><img src="image3.png"></center></p>
<p>
where <img src="image4.png">, which join at the endpoints <img src="image5.png"> such
that <img src="image6.png">, <img src="image7.png">, and <img src="image8.png"> are continuous.</p>
<p>
The smoothing function is constructed by minimizing</p>
<p>
<center><img align="absmiddle" src="image9.png"></center></p>
<p>
subject to the constraint</p>
<p>
<center><img align="absmiddle" src="image10.png"></center></p>
<p>
where <img align="absmiddle" src="image11.png"> are
the weights and <img align="absmiddle" src="image12.png"> is the spline tension.</p>
<p>
The solution proceeds by the standard methods of minimizing the functional</p>
<p>
<center><img src="image13.png"></center></p>
<p>
where <img src="image14.png"> and <img src="image15.png"> are auxiliary parameters.
The functional is minimized with respect to <img src="image14.png"> and
<img src="image15.png"> by setting the partial
derivatives with respect to <img src="image14.png"> and <img src="image15.png">
equal to zero.</p>
<P>
<a href="bivsmooth.htm"><font size="+1" color="olive">2D smoothing</font></a></P>
<p>
<a href="../Sinint/sinint.htm"><img align="top" border="0" src="../../../shadow_left.gif">
<font size="+1" color="olive">Sine integral</font></a><br />
<a href="../Struve/struve.htm"><img align="top" border="0" src="../../../shadow_right.gif">
<font size="+1" color="olive">Struve functions</font></a>
</P>
</BODY>
</HTML>
|