lookup table error in simulink

Hello I am trying to model a 2D lookup table in simulink. I am calling the break points and table data from workspace. When i run it it shows an error as "the number of dimensions specified by the 'Table data' parameter (1) must match the 'Number of table dimensions' parameter value (2)." but when I check the table dimensions are table data: 1x9000 and break point 1 : 1x9000 and break point 2: 1x9000 all are same. But still I am getting this error. Please guide me through it.

回答 (2 件)

Sai Sri Pathuri
Sai Sri Pathuri 2020 年 6 月 2 日

0 投票

Check whether you have set Number of table dimesions to 1, since your data is one-dimensional

4 件のコメント

vishnuvardhan naidu tanga
vishnuvardhan naidu tanga 2020 年 6 月 2 日
thank you for the reply. Actually I am trying to obtain the results with respect to two parameters.the code is as follows:
a = 1000;
b = 0.1;
h_out = zeros(1,((a-1)/b));
L = length(h_out);
for i = 1:L
T(i)= 1+b*i;
p(i) = 1+b*i;
h_out(i) = XSteam('h_pT', p(i), T(i));
end
so h_out depends on two variables T and P, so i need two break points T and P to define h_out. the code basically extracts the h_out from xsteam and saves into workspace, which is then again called in simulink. Is there any way to deal with it
Sai Sri Pathuri
Sai Sri Pathuri 2020 年 6 月 2 日
Did you run the code before adding these values in dialog box?
Can you click on errors at Breakpoints 1 and Breakpoints 2 beside p and T respectively and share the errors here?
vishnuvardhan naidu tanga
vishnuvardhan naidu tanga 2020 年 6 月 2 日
yes i run the code. when i run the code the break points are updated from the data base. the error marks in break points are eliminated. But the system wont run because of the following error:
In block 'SH', the number of dimensions specified by the 'Table data' parameter (1) must match the 'Number of table dimensions' parameter value (2).
Sai Sri Pathuri
Sai Sri Pathuri 2020 年 6 月 2 日
Set Number of table dimensions (I highlighted it in above screenshot) to 1 in the dialog box, because your input is one-dimensional

サインインしてコメントする。

Johannes Lips
Johannes Lips 2025 年 2 月 28 日
編集済み: Johannes Lips 2025 年 2 月 28 日

0 投票

The problem, which was not properly addressed in the previous answer, is the table data itself, not the dimensionality parameter.
For the 2D lookup table, you ought to use a row vector of length n1 for breakpoints 1, a row vector of length n2 for breakpoints 2, and a 2D matrix with size n1 x n2 for the table data.
Preprocessing (reshape or interpolate) of the 1x9000 data of this question is necessary to obtain the required inputs for the 2D lookup table block.
rangeX1 = %choose based on data e.g. min(x1):stepx1:max(x1)
rangeX2 = %similar
[X1grid, X2grid] = meshgrid(rangeX1, rangeX2);
% Create the scattered interpolant for your original data
F = scatteredInterpolant(x1, x2, y, 'linear', 'none');
% Evaluate the function on the grid
Ygrid = F(X1grid, X2grid);
Then use rangeX1, rangeX2 and Ygrid for the breakpoints and table data.

カテゴリ

ヘルプ センター および File ExchangeNonlinearity についてさらに検索

製品

編集済み:

2025 年 2 月 28 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by