linear interpolation in 3D space

6 vues (au cours des 30 derniers jours)
Kalonymus
Kalonymus le 10 Déc 2015
Modifié(e) : Kalonymus le 10 Déc 2015
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.

Réponse acceptée

John D'Errico
John D'Errico le 10 Déc 2015
Modifié(e) : John D'Errico le 10 Déc 2015
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 commentaire
Kalonymus
Kalonymus le 10 Déc 2015
Modifié(e) : Kalonymus le 10 Déc 2015
Thank you John!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by