triginterp(y,x=a..b) or triginterp(y,a,b,x) returns the trigonometric polynomial that interpolates data given in the list y . It is assumed that the list y contains ordinate components of the points with equidistant abscissa components between a and b such that the first element from y corresponds to a and the last element to b .
For example, y may be a list of experimental measurements of some quantity taken in regular intervals, with the first observation in the moment t=a and the last observation in the moment t=b . The resulting trigonometric polynomial has the period
T= |
| , |
where n is the number of observations ( n =size(y)). For example, assume that the following data is obtained by measuring the temperature every three hours:
hour of the day | 0 | 3 | 6 | 9 | 12 | 15 | 18 | 21 |
temperature (deg C) | 11 | 10 | 17 | 24 | 32 | 26 | 23 | 19 |
Furthermore, assume that an estimate of the temperature at 13:45 is required. To obtain a trigonometric interpolation of the data, input :
Output :
Now a temperature at 13:45 hrs can be approximated with the value of tp for x=13.75 . Input :
Output :
If one of the input parameters is inexact, the result will be inexact too. For example, input :
Output :