Models the data making a polynomial ansatz.
Input
Must be realvector. The output will be alligned with the input.
Parameters
The embedding dimension. Synonymous with flag ’-m’ from TISEAN [default = 2].
Delay used for embedding [default = 1].
Order of the polynomial [default = 2].
Number of points for the fit. The other points are used to estimate the out of sample error [default = length (X)].
The length of the predicted series [default = 0].
Output
This structure contains parameters used for the fit. It has the following fields:
Contains the forecasted points. It’s length is equal to the value of parameter l
See also: demo polynom.
Algorithms
The algorithms for this functions have been taken from the TISEAN package.
The following code
idx = (1:2500).'; # sin_saw is a sinusoid multiplied by a saw function sin_saw = (5 + mod (idx, 165) ./15) .* sin (idx.* 2 * pi /32); forc_no = 170; %Number of forecasted points [p,forecast] = polynom (sin_saw(1:end-forc_no), 'm', 2, 'd', 6, 'p', 4, 'n',length(idx)-forc_no, 'l',forc_no); plot (idx(end-forc_no+1:end), sin_saw(end-forc_no+1:end),'b',... idx(end-forc_no+1:end), forecast,'r.') legend ('Actual Data', 'Forecasted Data') axis tight
Produces the following figure
Figure 1 |
---|
Package: tisean