Convert 3D Lookup Table

6 ビュー (過去 30 日間)
Marv
Marv 2015 年 7 月 29 日
編集済み: Walter Roberson 2015 年 8 月 7 日
Hi,
I got a lookup table that looks like the following:
-Inf 40 50 60
0.70 22.70 9.24 6.78
0.65 20.45 8.85 6.42
0.60 19.23 8.48 6.69
0.55 18.04 8.03 6.28
0.50 16.89 7.63 6.49
Normally the inputs for the lookup table are:
X = 40 50 60
Y = 0.70 0.65 0.60 0.55 0.5
And the other values is the interpolated output Z.
Now I want to convert the lookup table / this matrix so that
Y=Z .
This means, that I want the Z and the X Values as input and X as output.
How can I convert the matrix to get this ?
Thanks :)
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 7 月 29 日
Your notation
Y=Z .
confuses me. You also said you want the Z and X as input and the X as output. Perhaps you want Z and X as input and Y as output? Y = Table(Z, X) ?

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

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 7 月 29 日
編集済み: Walter Roberson 2015 年 8 月 7 日
function Y = lookupY(X, Z)
XYZ = [-Inf 40 50 60
0.70 22.70 9.24 6.78
0.65 20.45 8.85 6.42
0.60 19.23 8.48 6.69
0.55 18.04 8.03 6.28
0.50 16.89 7.63 6.49];
[numrow, numcol] = size(XYZ);
xcol = interp1(XYZ(1,2:end), 2:numcol, X, 'nearest', 'extrap');
yrow = interp1(XYZ(2:end, xcol), 2:numrow, Z, 'nearest', 'extrap');
Y = XYZ(yrow, 1);
[note: some errors have been corrected]

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by