This section contains examples of usage of interpolation/approximation procedures of the package. List of availible examples:
1D Linear and nearest interpolationTop, Main, Index
The two most basic types of interpolation are linear and nearest ones. These types are availible with procedures ::tclinterp::interpolation::lin1d and ::tclinterp::interpolation::near1d. To demonstrate both type we use shifted sinusoidal function:
Relative error is calculated here and in all subsequent chapters is defined as:
Import all procedures from ::tclinterp namespace:
Define procedures for sinusoidal function calculation, error calculation and for generating sequence of x values:
Create input data, interpolation points xi
and exact values at these points:
Input data has points with 0.05 step, xi
values are separated by 0.01 step.
Zip input data for ticklecharts
plotting:
Call interpolation function ::tclinterp::interpolation::lin1d that returns list of interpolated y values, and zip xi
and yInterpLin
points:
Do the same for ::tclinterp::interpolation::near1d:
Zip exact values:
Calculate errors:
Plot and save results using ticklecharts
:
Results are:
ticklEcharts !!!