Convert 3D Lookup Table

6 visualizaciones (últimos 30 días)
Marv
Marv el 29 de Jul. de 2015
Editada: Walter Roberson el 7 de Ag. de 2015
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 comentario
Walter Roberson
Walter Roberson el 29 de Jul. de 2015
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) ?

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 29 de Jul. de 2015
Editada: Walter Roberson el 7 de Ag. de 2015
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]

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by