Interpolation with three arrays

조회 수: 1 (최근 30일)
tunny
tunny 2013년 5월 6일
if true
% code
x = [0 .25 0 .5 .5 1 .5 .75];
y = [0 .25 .5 0 .5 .5 1 .75];
t = [20.99 25.74 29.7 22.34 40.48 45.75 63.01 62.98];
a = TriScatteredInterp(x(:),y(:),t(:),'nearest');
pnt1 = a(0,1)
end
I have these three arrays of data and I am trying to interpolate for the value of t for different values of x and y. for example t when x = 0 and y = 1. For some reason my code above is not working. Any help or ideas would be appreciated.

답변 (1개)

Shashank Prasanna
Shashank Prasanna 2013년 5월 6일
Why do you think this is not working? It seems to be working fine:
>> pnt1 = a(0,0)
pnt1 =
20.9900
>> pnt1 = a(0,1)
pnt1 =
63.0100
  댓글 수: 2
tunny
tunny 2013년 5월 6일
in the triscatteredinterp delete the 'nearest' because that just picks up the value in the array that is closest.
Shashank Prasanna
Shashank Prasanna 2013년 5월 7일
It appears that you are interested in extrapolation rather than interpolation.
TriScatteredInterp does not support extrapolation. However, the recent release of MATLAB R2013a, introduced scatteredInterpolant which does.
You may have to upgrade to use this if you are on an older release.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by