Matrix Interpolation coordinates interp1

조회 수: 10 (최근 30일)
James
James 2013년 5월 2일
Hey guys, I'm trying to do something which should be simple but I just can't seem to write it. I have a matrix FX, and two vectors of coordinates, x&y, and these coordinates are changing in an iterative loop.
After each iteration, I need to find the value of FX at the new coordinates (FX(x,y)) but the coordinates aren't integers, so I need to do some sort of interpolation to find the closest F(xi, yi) that I can. I was thinking it would just be,
fex = interp1([round(x),round(y)],FX,[x,y], 'linear')
But that complains about not being monotonic (they're not meant to be). Any ideas on how to approach this one?
Thanks

채택된 답변

Matt J
Matt J 2013년 5월 2일
편집: Matt J 2013년 5월 2일
Use griddedInterpolant,
f=griddedInterpolant(FX); %Do this prior to loop
for i=1:N
%generate x and y
fex=f(x,y);
end

추가 답변 (0개)

카테고리

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