| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Suppose you want to approximate the common logarithm (base 10) over the input range [1, 10] without performing an expensive computation. You can perform this approximation using a lookup table block as described in the following procedure.
Copy the following blocks to the Simulink model window:
A Constant block to input the signal, from the Sources library
A Lookup Table (n-D) block to approximate the common logarithm, from the Lookup Tables library
A Display block to display the output, from the Sinks library
Assign the table data and breakpoint data set to the Lookup Table (n-D) block:
In the Number of table dimensions field, enter 1.
In the Table field, enter [0 .301 .477 .602 .698 .778 .845 .903 .954 1].
Alternatively, you can enter the MATLAB expression log10(1:10) in this field, which evaluates to the equivalent vector of output values.
In the BP 1 field, enter [1:10].
Click Apply.
The dialog box looks something like this:

Click the Algorithm tab in the Lookup Table (n-D) block dialog box.
By default, the Interpolation method and Extrapolation method are both Linear.

Click OK to close the dialog box.
Double-click the Constant block to open the parameter dialog box, and change the Constant value parameter to 5. Click OK to apply the changes and close the dialog box.
Connect the blocks as follows.

In the model window, select Simulation > Start to run the simulation.
The following behavior applies to the Lookup Table (n-D) block.
| Value of the Constant Block | Action by the Lookup Table (n-D) Block | Example of Block Behavior | |
|---|---|---|---|
| Input Value | Output Value | ||
| Equals a breakpoint | Returns the corresponding output value | 5 | 0.698 |
| Falls between breakpoints | Linearly interpolates the output value using neighboring breakpoints | 7.5 | 0.874 |
| Falls outside the range of the breakpoint data set | Linearly extrapolates the output value from a pair of values at the end of the breakpoint data set | 10.5 | 1.023 |
![]() | Lookup Table Editor | Examples for Prelookup and Interpolation Blocks | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |