How to build a 2-D lookup table?

Hello,
I have measeared data in Excel. Inputs are x and y , according them an output z. All three have the dimensions (nx1). How can I make a 2-D lookup table with them? I tried and got a dimension-error. Eventually I have to make an interpolated matrix of my output z , but I do not know how. Does anybody have an idea? Thanks.

Answers (1)

Walter Roberson
Walter Roberson on 22 Feb 2017
Unless there are repeated values forming an implicit grid, you should be using TriScatteredInterp or ScatteredInterpolant

4 Comments

Thanks for your answer.
I tried with ScatteredInterpolant, and still could not bring my output to the right dimensions. As in the ScatteredInterpolant example see below, I need the output v in the dimension 200x200 , that is exactly my Problem. How can I do that?
xy = -2.5 + 5*gallery('uniformdata',[200 2],0);
x = xy(:,1);
y = xy(:,2);
v = x.*exp(-x.^2-y.^2);
F = scatteredInterpolant(x,y,v);
ti = -2:.25:2;
[xq,yq] = meshgrid(ti,ti);
vq = F(xq,yq);
...
Change the assignment to ti to be a vector of values with 200 entries. For example one version would be
ti = linspace(-2, 2, 200);
Now it works:) Thank you !

Sign in to comment.

Asked:

on 22 Feb 2017

Commented:

on 3 Sep 2019

Community Treasure Hunt

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

Start Hunting!