필터 지우기
필터 지우기

linear interpulation 3D triangle

조회 수: 2 (최근 30일)
chen fire
chen fire 2016년 9월 27일
답변: KSSV 2016년 9월 27일
hey there, I have a triangle in coordinates (x1,y1,z1) , (x2,y2,z2),(x3,y3,z3). There exist a function f(x,y,z) inside the tirangle that has v1,v2,v3 values on the given coordinates.
i want to interpulate the 3 known coordinates, so i will recive the function inside (linear interpulation). can u please help me to write it?
thanks a lot!
  댓글 수: 2
KSSV
KSSV 2016년 9월 27일
Question is not clear....you have data at nodes of 3D triangle, you need to interpolate to get data any where in side triangle? Is this the task?
chen fire
chen fire 2016년 9월 27일
yes, exactlly

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

답변 (1개)

KSSV
KSSV 2016년 9월 27일
% triangle vertices
data = rand(3,3) ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
%
P = [x,y] ; V = z ;
F = scatteredInterpolant(P,V) ;
F.Method = 'natural';
F.ExtrapolationMethod = 'none' ;
% Take a point lying insuide the region for interpolation
pq = [sum(x) sum(y)]/3 ;
Vq = F(pq) ;
% plot
v = [data ; data(1,:)] ;
plot3(v(:,1),v(:,2),v(:,3)) ;
hold on
plot3(pq(1),pq(2),Vq,'*r')

카테고리

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