MATLAB: 3D interpolation on a table

3d interpolationsinterp3?

Hello All,
I'm pretty new to matlab and I want to perform a 3D interpolation on a 70 x 7 matrix table. I've read the documentation for 3D but I don't seem to be able to apply it. Here is an example. For instance, if A = 0.33; B = 2.5, what will be the value of C at 75%? Thanks.
A B C
1% 25% 50% 75% 100%
0.30 2 1.1 1.5 1.0 0.3 0.8
0.30 3 1.6 1.8 1.0 0.5 0.8
0.30 4 1.3 1.1 1.0 0.8 0.8
0.30 5 1.2 1.1 1.0 0.6 0.7
0.30 6 1.3 1.1 1.0 0.8 0.7
0.30 7 1.3 1.2 1.0 0.8 0.7
0.30 8 1.3 1.1 1.0 0.8 0.7
0.30 9 1.3 1.1 1.0 0.8 0.7
0.30 10 1.3 1.1 1.0 0.8 0.7
0.30 11 1.8 1.3 1.0 0.8 0.7
0.35 2 1.3 1.8 1.0 0.9 0.1
0.35 3 1.6 1.9 1.0 0.9 0.8
0.35 4 1.4 1.2 1.0 0.9 0.8
0.35 5 1.2 1.1 1.0 0.8 0.8
0.35 6 1.4 1.2 1.0 0.8 0.7
0.35 7 1.3 1.1 1.0 0.8 0.7
0.35 8 1.2 1.1 1.0 0.8 0.7
0.35 9 1.3 1.5 1.0 0.8 0.7
0.35 10 1.9 1.4 1.0 0.8 0.7
0.35 11 1.3 1.1 1.0 0.8 0.8

Best Answer

>> f = fopen('yourdata.txt');
cc = textscan(f,'%f %f %f %f %f %f %f ','HeaderLines',2,'CollectOutput',1 );
fclose(f);
g = cc{:};
[A,B,C] = ndgrid(unique(g(:,1)),unique(g(:,2)),[1 25 50 75 100]);
n = size(A);
V = permute(reshape(g(:,3:end),n([2,1,3])),[2,1,3]);
F = griddedInterpolant(A,B,C,V);
>> out = F(.35,4,1)
out =
1.4000
Related Question