LookupTableND_file

This block approximates a non-linear function using interpolation on data provided as an "n-dimensional table" the data is read from a .mat file.

    LookupTableND_file

Library

Activate/LookupTables

Description

Data of the LookupTableND_file are provided by a .mat file. In this file, n input vectors and table data are defined. Each input vector is a row vector, table data is a also row vector, the results varying according to the order of the n input vectors. Table data is a combination of the data for a variation of the first input over a variation of the second input over a variation of the third input and so on.

For example, for 2 input vectors, the table data varies by all of values the input vector 1 for *only* the first value of input vectors 2. After this is exhausted, the next values in Table Data varies by incrementing to the second value of input vector 2 while also incrementing through all of the vales of input vector 1 at this second value. This continues until all of the values of the second input vector are completed. With additional input vectors, the same pattern persists to increment through the next input vector values while incrementing through the prior input vector values.

Input vector 1: [x1 x2 x3]
Input vector 2: [y1 y2]
Input vector 3: [z1 z2]
Table data: [x1y1z1, x2y1z1, x3y1z1, x1y2z1, x2y2z1, x3y2z1, x1y1z2, x2y1z2, x3y1z2, x1y2z2, x2y2z2, x3y2z2]

Parameters

LookupTableND_file_0

NameLabelDescriptionData TypeValid Values

fname

File name

Defines the name (path and full name, in between quotes) of the input .mat file.

String

nDims

Number of dimensions

Number of dimensions of the lookup table. One dimension corresponds to one input.

Number

varnames

Scale variable names

Structure

varnames/name

Name of the scale variable

Name of scale variable.

Cell of strings

table_name

Name of the table data variable

Name of the second scale variable.

String

Method

Interpolation method

Interpolation method. Default: Akima.

String

'ZeroOrder(floor)'
'ZeroOrder(nearest)'
'Linear'
'Akima'
'Fritsch_Butland'
'Steffen'

DoOutside

Result outside the table range

Action to be taken with the results outside of the table range.

String

'Hold'
'Linear'
'Zero'
'Error'

externalActivation

External activation

Specifies whether the block receives an external activation or inherits its activation through its regular input ports. When External Activation is selected, an additional activation port is added to the block. By default, external activation is not selected.

Number

0
1

Ports

NameTypeDescriptionIO TypeNumber

Port 1

explicit

output

1

Port 2

explicit

input

nDims

Port 3

activation

input

externalActivation

Example

The demo model LookupTableND_file.scm is available in demo browser in folder Activate/Basics/LookupTable.

The input vectors and table data defined in tableData.mat are the same as those used in demo model LookupTableND.scm. They can be saved into .mat file as follows:

f = [fileparts(bdeGetCurrentModelFilePath), '/'];
% Save MAT file
%save(tableFile, 'rU1', 'rU2', 'rU3', 'TD');

See Also