linear interpolation in 3D space

조회 수: 6 (최근 30일)
Kalonymus
Kalonymus 2015년 12월 10일
편집: Kalonymus 2015년 12월 10일
by given 2 points in space: (x1,y1,z1), (x2,y2,z2) how can I make linear line between them and get bigger vector with x,y,z position i.e vector in size 3x100 - 3 to indicates x,y,z and 100 for the number of points (100 is just for example, it can be changed.

채택된 답변

John D'Errico
John D'Errico 2015년 12월 10일
편집: John D'Errico 2015년 12월 10일
Easy, peasy. Pick two points (of my arbitrary choosing.)
P1 = [1 2 3];
P2 = [7 5 -2];
n = 100;
t = linspace(0,1,n)';
P = (1-t)*P1 + t*P2;
  댓글 수: 1
Kalonymus
Kalonymus 2015년 12월 10일
편집: Kalonymus 2015년 12월 10일
Thank you John!

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

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