Lookup Table
MathThe LookupTable block implements a one-dimensional lookup table with configurable linear or cubic spline interpolation and extrapolation. It maps an arbitrary scalar input to an interpolated output value using a set of strictly monotonically increasing input breakpoints () and corresponding output values ().
In the Property Editor, both series ( and ) are edited side-by-side in an Excel-style spreadsheet (Spreadsheet (X / Y)) paired with a live LUT curve preview (y = f(x)) that immediately visualizes every point and interpolation mode (linear or spline). Calibration tables can also be saved and loaded directly via CSV Import / Export (lut_data.csv), supporting standard comma (,), European semicolon (;), and tab (\t) delimiters.
Mathematical Model
Given strictly monotonically increasing input breakpoints and corresponding output table values :
For an input falling within the breakpoint interval ():
When interpolation is set to spline, the block constructs a natural cubic spline through all data points, ensuring continuous first and second derivatives ( continuity) across knot boundaries:
When the input falls outside the breakpoint range ( or ), the output is governed by the extrapolation mode:
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
In | number | Required |
| ← Out | out |
Out | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
breakpoints |
Lookup Table (X / Y) | table | 0 1 2 3 |
|
tableData |
Table Data | text | 0 1 4 9 |
|
interpolation |
Interpolation | select | linear |
|
extrapolation |
Extrapolation | select | clip |
Usage Examples
Example 1: NTC Thermistor Temperature-to-Resistance Linearization
In temperature monitoring circuits, negative temperature coefficient (NTC) thermistors exhibit highly nonlinear exponential resistance curves. Entering ADC voltage rows and calibrated temperatures into the LookupTable spreadsheet (or importing them from a calibration CSV) with linear or spline interpolation yields an accurate, linearized temperature signal in degrees Celsius () across the operational range.
Example 2: Aerodynamic Wing Lift Coefficient Curve with Stall Clamping
Simulating aerodynamic lift coefficient as a function of angle of attack in degrees. Breakpoints -15 -10 0 10 15 20 map to table data -0.8 -0.6 0.1 1.1 1.4 0.9. Setting extrapolation = clip ensures that extreme aerodynamic angles during severe wind gusts do not extrapolate into unphysical supersonic lift forces.
Remarks & Best Practices
- Interactive Spreadsheet & Live Preview: Double-clicking the block opens an Excel-style two-column sheet (
XandY) with row numbers,+ Add Row (Point), row deletion (ร), and a live uPlot curve preview that updates as you type. - CSV Save & Load (Import / Export & Excel Paste): Click Export CSV to download the current table as
lut_data.csv(X,Ycolumns), Import CSV to load measurements from Excel/CSV files (comma, semicolon, or tab separated), or paste multi-row selections directly from Excel (Ctrl+V). - Monotonic Breakpoint Requirement: The values in
breakpoints() are automatically sorted in ascending order (). - Fast Binary Interval Search: The WASM simulation engine employs an binary partition search to identify active intervals, ensuring high-speed lookup execution even with large empirical datasets.
- Continuous Derivative Preservation: Selecting
splineinterpolation prevents sharp slope discontinuities at knots, ensuring smooth integration when interacting with variable-step continuous ODE solvers such as RK45 or TR-BDF2.
Frequently Asked Questions (FAQ)
Q: How does lookup table interpolation handle out-of-bounds input values?
BlockWerk clamps inputs to the table boundary limits (flat extrapolation) by default. Flat clamping protects physical models (e.g. non-negative friction, engine torque maps, or fluid density) against runaway divergence, whereas unrestricted linear extrapolation can produce non-physical negative values that crash downstream ODE solvers.
Related Components
- LookupTable2D: Two-dimensional lookup table with interactive 2D matrix spreadsheet and bilinear/bicubic surface interpolation .
- MathFunction: Standard mathematical functions (, , , ).
- Saturation: Clamps dynamic signals between fixed lower and upper bounds.