back start next


[start] [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]


68

Now move the whole process in time forward by one data point. Thus, Sq in the preceding computation becomes S-j in the new one;5.i in the preceding computation becomes 5o in the new one; and the next later data point becomes the new S*i. Redefine r = 0 at the new Sf, and complete a new segment of interpolation. Proceed in this manner until the data to be interpolated are exhausted.

EQUATION DERIVATION

The standard form of the equation of a parabola is:

where: t = time

S(t) = function to be interpolated uoiii, & «2 = constants to be determined for each set of three values of S(() between which interpolation is deshed.

The least-square-error equations for the values of , , & are:

25 = ffo- + «i2r tajS/ ] iV= Number of data points to

S/s = aoS/+ 0,2?+32 \ be fitted and the summations

rr -s = aZt + , 2/3 + flj 2r* \ to be carried out over the tune

interval corresponding to the fitted data.

For our case, where N ~3 and = 0 is chosen to correspond with Sq : 2? = 0 and 2r = 0

So that the coefficient equations reduce to: 2s = (3)flo + (0)ai +{Sr2)aj 2/-5 = (0)co + (2/2)31 +(0)fl2 Z/ -s = (2/2 )flo + (0)fli + (2/)a2

With a digital data spacing of "s" equal to /, the summations are evaluated and substituted as follows:

So + (5., + 5Li) = (3)flo + (0)fli + (2/2 )fl2 (5., + 5L,) = (0)ao + (2/„ )a 1 + { t4S*, + ) = (2 )ao + (0)fl, + (2/;)a2

Solving these three equations simultaneously for the values of Uq, Ai, and ui yields:

.1--

(5.i +i)- 2So «2 -275



The desired equation of the least-square-error parabola fitted through any set of S-i So, and 5.1 is then:

Sm = 5o +

-27?-

Substitution of the values of , o, S.,, and any desired values of time: 0<t <t provides the needed interpolation values of the function S(t) (output from a specific fMter).



appendix six

Trigonometric Curve Fitting

« Generalized Least-Square-Error Methods

• Solving For Frequency

• Computing Amplitudes

• Determining Composite Amplitudes and Phases

The use of numerical filters on stock price data results in the generation of sampled functions which contain a reduced number of spectral components. In manipulating these functions it is often desirable to determine analytically the frequencies, amph-tudes, and phases of the .summed sinusoids present This can be accomplished (and high frequency smoothing gained at no cost in additional time lag) by the trigonometric curve-fitting method described here.

GENERALIZED LEAST-SQUARE-ERROR METHODS

The technique to be described requires a generalized form of the least-square-error curve fit method. This procedure will be demonstrated using the trigonometric functions of interest to us; however, the process is quite general and can be used to fit data with any kind of rational function.

Suppose we have utilized a band-pass filter to obtain a function of time containing "m" of the components of our spectral model. The approximation equation of the filter output is then:

(1) so) (a iCosiOit + I sinw,/)+ + (a cos(jjt + b sintof)

Let us say we have N > 2m filter output data pomts. We write the set of N equations which postulate that equation (1) is true at each of the times corresponding to the N filter outputs:



[start] [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]