Convert 3D Lookup Table
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 29 Juil 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) ?
Réponses (1)
Walter Roberson
le 29 Juil 2015
Modifié(e) : Walter Roberson
le 7 Août 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]
0 commentaires
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!