# Lookup Table (`lookup`)

> Looks up an output from a table of points, with straight lines between them.

![lookup](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/lookup.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/lookup/)

**Group:** Control · **Kind:** `{"block":"lookup","kind":"control"}`

## When to use it

Use it for a measured curve, a nonlinear sensor or a torque-speed profile. Use Gain for a straight line and Limiter for a plain cutoff.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in` | signal | Value to look up in xs |
| `out` | signal | Matching value from ys |

## Common parameters

- `xs`: Input points, smallest first, with commas (Default: required)
- `ys`: Output values for those points, with commas (Default: required)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `xs` | — | required |  | Input points, smallest first, with commas |
| `ys` | — | required |  | Output values for those points, with commas |

_Parameter descriptions are in English in both languages._

## Model

Between two points the output is the straight line through them, y = y0 + (y1 - y0)*(x - x0)/(x1 - x0). Below the first point it holds the first ys value, and above the last point it holds the last one (no extrapolation). The block has direct feedthrough and no state. Both lists are comma separated and can use expressions.

## Common mistakes

- xs must rise strictly, and xs and ys must have the same length and not be empty, or the build stops. A repeated x value is not allowed, so for a vertical step use two points very close together.
- Outside the table the output stays flat and is not extended. A signal that leaves the range looks like saturation without a warning, so cover the full range of the input.

Problems rules: `compile.error`

## Datasheet and sources

The table comes from your own data or a datasheet graph, such as an NTC resistance against temperature or a saturation curve read at several points. Both columns use the units of the signals around the block.

## Example

Open the example with the command `file.openExample` and the name `demo:lookup`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
