필터 지우기
필터 지우기

3d interpolation using points?

조회 수: 3 (최근 30일)
Jamal
Jamal 2016년 4월 22일
댓글: Manas Biswal 2021년 8월 10일
I have these points: p1=(30 0 0.2035) , p2=(0 0 0.0357) , p3= (30 60 0.4717), p4=(30 0 0.1038), p5=(30 30 0.4606) I'd like to interpolate between them and plot the interpolation. How? Thanks

채택된 답변

KSSV
KSSV 2016년 4월 22일
3D Interpolation using parametric cubic spline.
clc; clear all ;
% Inteprolation using Parametric cubic spline
% Given points
P = [30 0 0.2035 ;
0 0 0.0357 ;
30 60 0.4717 ;
30 0 0.1038 ;
30 30 0.4606] ;
x = P(:,1) ; y = P(:,2) ; z = P(:,3) ;
% Get the arc lengths of the curve
n = length(x) ;
L = zeros(n,1) ;
for i=2:n
arc_length = sqrt((x(i)-x(i-1))^2+(y(i)-y(i-1))^2+(z(i)-z(i-1))^2);
L(i) = L(i-1) + arc_length;
end
% Normalize the arc lengths
L=L./L(n);
% do the spline
x_t = spline(L,x) ;
y_t = spline(L,y) ;
z_t = spline(L,z) ;
% for interpolation
tt = linspace(0,1,500) ;
xi = ppval(x_t,tt) ;
yi = ppval(y_t,tt) ;
zi = ppval(z_t,tt) ;
plot3(x,y,z,'.-r') ;
hold on
plot3(xi,yi,zi,'.b') ;
legend('Given points' , 'interpolated') ;
  댓글 수: 3
KSSV
KSSV 2016년 4월 25일
where is the data?
Manas Biswal
Manas Biswal 2021년 8월 10일
Where is the data?

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

추가 답변 (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