Using interp2 to interpolate points on a path

load('ProjectTerrain.mat');
for k=1:500
xxx=[-4.8:k:4.8];
yyy=[4:k:-4.8];
a(k)=interp2(x,y,T,xxx,yyy);
end
I have a dataset of 3D terrain data that gives the elevation at certain points (x,y,T), and am trying to interpolate points on a path 500 steps long but am not sure how to start. The coordinates for the start and end points are in xxx and yyy.

 채택된 답변

Chad Greene
Chad Greene 2014년 5월 21일

0 개 추천

The loop is unnecessary. Try something like this:
load('ProjectTerrain.mat')
xxx = linspace(-4.8,4.8,500);
yyy = linspace(4,-4.8,500);
TTT = interp2(x,y,T,xxx,yyy);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

태그

질문:

2014년 5월 21일

답변:

2014년 5월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by