Interpolation from a table

Hello, I have put in my script a table like this one to find the value K0 :
i have both value e/b, for select column, and y/b for the rows.
As you can immagine i need a double interpolation to find my value of K0. If we put e/b = 0.23 (red) and y/b = 0.60 (blue) how can i select the values insite the intersection between the red columns and the blue rows for the final interpolation?
Hope is all clear
Ty for your answers

回答(1 个)

The interp2 function is one option —
eb = [0 0.25];
yb = [0.5; 0.75];
K0 = [1.0009 1.3767; 0.9948 1.5583];
Check = [NaN eb; yb K0]
Check = 3×3
NaN 0 0.2500 0.5000 1.0009 1.3767 0.7500 0.9948 1.5583
ebq = 0.1; % 'e/b' Value To Interpolate
ybq = 0.6; % 'y/b' Value To Interpolate
K0q = interp2(yb, eb, K0, ybq, ebq) % Interpolated 'K0' Value
K0q = 1.1788
figure
surfc(yb, eb, K0, 'FaceAlpha',0.9)
hold on
stem3(ybq, ebq, K0q, 'r', 'filled')
hold off
colormap(turbo)
grid on
xlabel('y/b')
ylabel('e/b')
zlabel('K0 (\theta = 0.20)')
.

类别

帮助中心File Exchange 中查找有关 Interpolation 的更多信息

产品

版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by