散乱数据插值

use*_*217 5 arrays matlab interpolation matrix

我有一组数据,例如:

X Y Z

1 3 7

2 5 8

1 4 9

3 6 10
Run Code Online (Sandbox Code Playgroud)

我想插ZX=2.5Y=3.5.我该怎么做?我不能使用interp2,因为这里XY没有严格单调(增加或减少).

cha*_*pjc 9

目前执行散乱数据插值的首选方法是通过scatteredInterpolant对象类:

>> F = scatteredInterpolant([1 2 1 3].',[3 5 4 6].',[7 8 9 10].','linear') %'
F = 
  scatteredInterpolant with properties:

                 Points: [4x2 double]
                 Values: [4x1 double]
                 Method: 'linear'
    ExtrapolationMethod: 'linear'
>> Zi = F(2.5,3.5)
Zi =
    6.7910
Run Code Online (Sandbox Code Playgroud)

替代语法,

>> P = [1 3 7; 2 5 8; 1 4 9; 3 6 10];
>> F = scatteredInterpolant(P(:,1:2),P(:,3),'linear')
Run Code Online (Sandbox Code Playgroud)

对于优势scatteredInterpolantgriddata看到上插值散乱数据此MathWorks公司网页.除语法差异外,外推和自然邻域插值有两个主要优点.如果要使用相同的插值来插入新数据,那么您还具有重复使用在创建插值对象时计算的三角测量的性能优势.


Sha*_*hai 5

这似乎griddata是你正在寻找的功能:

z = griddata( [1 2 1 3], [3 5 4 6], [7 8 9 10], 2.5, 3.5, 'nearest' )
Run Code Online (Sandbox Code Playgroud)