Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Student Reviews


For Business / Universities

Corporate Training

Hire from US

Academic Up-skilling



All Courses

Choose a category

Loading...

All Courses

All Courses

logo

Electrical

Uploaded on

29 Sep 2022

How to use Lookup Table in Simulink?

logo

Skill-Lync

A lookup table is an array of data that maps input values to output values, thereby resembling a mathematical function. A lookup operation retrieves the corresponding output values from the table if there is a given set of input values. In other words, a lookup table computes an approximation to some mathematical function y=f(x), given data vectors x and y. We can define the lookup table by specifying a vector of output values parameter as a 1-by-n vector. The lookup table block in Simulink generates an output based on the input values using one of the methods selected from the Look-up method parameter list. If the lookup table does not define the input values, the block estimates the output values based on a nearby table

Methods used in Lookup Table in Simulink

Below are the common methods used:

  1. Interpolation: It is a process for estimating values that lie between known data points.
  2. Extrapolation: It is a process for estimating values that lie beyond the range of known data points.
  3. Rounding: It is a process for approximating a value by altering its digits according to a known rule.

If we go to Simulink and type a lookup table, this is how it appears (image below). You can go to the library browser.

There are several lookup tables available in the Lookup table block library with different functions.

The following example illustrates a one-dimensional lookup table that approximates the function y = x^3

The lookup table defines its output (y) data discretely over the input (x) range [-2, 2]. 

The lookup table defines its output (y) data discretely over the input (x) range [-2, 2].

The above figure shows the breakpoints of the function when plotted in the XY axis

Interpolation-Extrapolation- -This is the default method used to plot the breakpoints. it performs linear interpolation and extrapolation of the inputs.

  • If a value matches the block's input, the output is the corresponding element in the output vector.
  • If no value matches the block's input, then the block performs a linear interpolation between the two appropriate elements of the table to determine an output value. If the block input is less than the first or greater than the last input vector element, then the block extrapolates using the first two or last two points.

When the lookup table block encounters an input that does not match any of the table's x values, it can interpolate or extrapolate the answer. For instance, the lookup table does not define an input value of -1.5; however, the block can linearly interpolate the nearest adjacent data points. For example, given these two points:

Similarly, although the lookup table does not include data for x values beyond the range of   [-2, 2], the block can extrapolate values using a pair of data points at either end of the table.

If an input falls between breakpoint values or outside the range of a breakpoint data set and you do not specify interpolation or extrapolation, the block rounds the value to an adjacent breakpoint and returns the corresponding output value. If you explore the Lookup Table Dynamic block, it lets you select any of the rounding methods

Click on the drop-down for rounding options:

How to use a Lookup Table in Simulink? 

Here is an example of the rounding method in Simulink

This example shows how to use the Lookup Table Dynamic block to approximate the sinh function. The breakpoint data is given by the vector [-5:5] and the vector sinh gives the table data ([-5:5]). The input x is provided by the Constant block with a vector 1.4

The simulation time was given as 10s. Three constant blocks were used for giving the input values and the lookup table dynamic block is used to map the output. The rounding method option for the nearest input value was given. So the lookup table uses the value for sinh (1.0) which is near to 1.4.value given in the input. You can analyse the results by changing the option in the Lookup dynamic block and giving different input values.

Here is a simple example of a 1D Lookup table in Simulink

The input is taken as a Repeating stair sequence and the values given are 6 2.5 4 with a sample time of 1. The lookup table is configured as shown below.

Parameter estimation

Table and Breakpoints

Breakpoints: Feed the x values of the function

Breakpoint Specification: Specify whether to enter data as explicit breakpoints or as parameters that generate evenly spaced breakpoints.

Table Data: Enter the table of output values (Here, Feed the Y values of the function)

Data Specification: Specify the table data and breakpoints

Number of Table Dimensions: Enter the number of dimensions of the lookup table ( Here it is 1 (because we use a 1D lookup table))

The values given here are such that the output will give twice the value of the input .; y=2x

The algorithm was set to Linear point-slope for the Interpolation method, and by default, the option for Linear will be set for the Extrapolation method.

Data types were kept as default

Results

The simulation is carried out for 3s because we have given only three values at the input side (repeating sequence stair). We have defined a mathematical function y=2x using a lookup table in this article

From the scope, you can see that the Lookup table plot gives values which are double the input values from repeating sequence stairs. Likewise, you can define a mathematical function with one variable. You can use a 2D lookup table for defining two variables.

 


Author

author

Navin Baskar


Author

blogdetails

Skill-Lync

img

Continue Reading

Related Blogs

Control System Designer basics

The controlSystemDesigner tool is primarily used for designing single-input, single-output (SISO) controllers with feedback systems.

Electrical

18 May 2023


Filters Used In Electronics Circuits

A filter is a circuit capable of passing certain frequencies while attenuating (to reduce or block) other frequencies. Thus, a filter can extract important frequencies from signals that also contain undesirable or irrelevant frequencies.

Electrical

17 May 2023


What is a lookup table?

A lookup table is an array of data that maps input values to output values, thereby resembling a mathematical function.

Electrical

13 May 2023


Overview of Stateflow and building of models

Control logic is a paramount part of a software program that controls the operations of the program. The control logic answers to commands from the user, and it also acts on its own to execute automated tasks that have been structured into the program.

Electrical

11 May 2023


Ultracapacitors and Fuel Cell Hybridization

Continuing our series of articles on fuel cells and ultracapacitors for EV, this short article gives a quick rundown on the basics of ultracapacitors. You will also learn about fuel cell hybridization and the high-level components of software needed to develop fuel cell systems.

Electrical

10 May 2023



Author

blogdetails

Skill-Lync

img

Continue Reading

Related Blogs

Control System Designer basics

The controlSystemDesigner tool is primarily used for designing single-input, single-output (SISO) controllers with feedback systems.

Electrical

18 May 2023


Filters Used In Electronics Circuits

A filter is a circuit capable of passing certain frequencies while attenuating (to reduce or block) other frequencies. Thus, a filter can extract important frequencies from signals that also contain undesirable or irrelevant frequencies.

Electrical

17 May 2023


What is a lookup table?

A lookup table is an array of data that maps input values to output values, thereby resembling a mathematical function.

Electrical

13 May 2023


Overview of Stateflow and building of models

Control logic is a paramount part of a software program that controls the operations of the program. The control logic answers to commands from the user, and it also acts on its own to execute automated tasks that have been structured into the program.

Electrical

11 May 2023


Ultracapacitors and Fuel Cell Hybridization

Continuing our series of articles on fuel cells and ultracapacitors for EV, this short article gives a quick rundown on the basics of ultracapacitors. You will also learn about fuel cell hybridization and the high-level components of software needed to develop fuel cell systems.

Electrical

10 May 2023


Book a Free Demo, now!

Related Courses

https://d28ljev2bhqcfz.cloudfront.net/maincourse/thumb/introduction-automotive-embedded-systems-autosar_1615035557.jpg
Introduction to Automotive Embedded Systems and AUTOSAR
4.9
44 Hours of content
Embedded Domain
Know more
https://d28ljev2bhqcfz.cloudfront.net/maincourse/thumb/embedded-c-essentials_1645101913.jpg
5
35 Hours of content
Embedded Domain
https://d28ljev2bhqcfz.cloudfront.net/maincourse/thumb/fundamentals-embedded-systems_1639724607.jpgRecently launched
13 Hours of content
Embedded Domain
https://d28ljev2bhqcfz.cloudfront.net/maincourse/thumb/vlsi_1604169904_1604432901.jpgRecently launched
22 Hours of content
Electronics Domain
Showing 1 of 5 courses
Try our top engineering courses, projects & workshops today!Book a Live Demo