Menu

Workshops

Projects

Blogs

Careers

Find Jobs


For Business / Universities

Corporate Training

Hire from US

Academic Up-skilling


All Courses

Choose a category

Loading...

All Courses

All Courses

logo

Loading...

FOR BUSINESSES

Corporate Upskilling

Hire from Us

FOR Universities

Academic Training

More

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

Do Not Be Just Another Engineer: Four Tips to Enhance Your Engineering Career

Companies seek candidates who can differentiate themselves from the colossal pool of engineers. You could have a near-perfect CGPA and be a bookie, but the value you can provide to a company determines your worth.

Electrical

04 Jul 2022


Electric PowerTrain for Two Wheelers

The average vehicle body gives any vehicle its structural integrity, while the electric motor is concerned with the generation of torque or force. The electric motor can be a permanent magnet synchronous motor, brushless dc motor etc.

Electrical

25 Aug 2022


How To Tune PID Controllers for Converter Feedback

In industrial control applications, a PID controller is a device that regulates temperature, flow, pressure, speed, and other process variables. PID (proportional integral derivative) controllers, which use a control loop feedback mechanism to control process variables, are the most accurate and trustworthy controllers.

Electrical

27 Aug 2022


Pulse Charging of Lithium Ion Battery

A lithium-ion (Li-ion) battery is a complicated battery technology that uses lithium ions as a key component of its electrochemistry. During a discharge cycle, lithium atoms within the anode are ionized and separated from their electrons.

Electrical

29 Aug 2022


A Guide on the Dashboard Library Blockset

Dash in your car is your source of information. It basically functions as a control panel that sits in front of the driver and shows numerous controls and instrumentation required for your car to function.

Electrical

01 Sep 2022



Author

blogdetails

Skill-Lync

img

Continue Reading

Related Blogs

Do Not Be Just Another Engineer: Four Tips to Enhance Your Engineering Career

Companies seek candidates who can differentiate themselves from the colossal pool of engineers. You could have a near-perfect CGPA and be a bookie, but the value you can provide to a company determines your worth.

Electrical

04 Jul 2022


Electric PowerTrain for Two Wheelers

The average vehicle body gives any vehicle its structural integrity, while the electric motor is concerned with the generation of torque or force. The electric motor can be a permanent magnet synchronous motor, brushless dc motor etc.

Electrical

25 Aug 2022


How To Tune PID Controllers for Converter Feedback

In industrial control applications, a PID controller is a device that regulates temperature, flow, pressure, speed, and other process variables. PID (proportional integral derivative) controllers, which use a control loop feedback mechanism to control process variables, are the most accurate and trustworthy controllers.

Electrical

27 Aug 2022


Pulse Charging of Lithium Ion Battery

A lithium-ion (Li-ion) battery is a complicated battery technology that uses lithium ions as a key component of its electrochemistry. During a discharge cycle, lithium atoms within the anode are ionized and separated from their electrons.

Electrical

29 Aug 2022


A Guide on the Dashboard Library Blockset

Dash in your car is your source of information. It basically functions as a control panel that sits in front of the driver and shows numerous controls and instrumentation required for your car to function.

Electrical

01 Sep 2022


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
20 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 FREE Demo