Effacer les filtres
Effacer les filtres

create many points on the same line

14 vues (au cours des 30 derniers jours)
noa
noa le 29 Déc 2012
hi
i have two points - x1,y1,z1; x2,y2,z2
i want to create a vector with many points between these two points, and that these points will all be on the same line.
how can i do that?
thanks!

Réponse acceptée

Matt J
Matt J le 29 Déc 2012
Modifié(e) : Matt J le 29 Déc 2012
x=linspace(x1,x2,N);
y=linspace(y1,y2,N);
z=linspace(z1,z2,N);

Plus de réponses (1)

Image Analyst
Image Analyst le 30 Déc 2012
As an aside, if you want the points to be equidistant along some arbitrary curve, bending and turning all over the place, then you can use John D'Errico's interparc http://www.mathworks.com/matlabcentral/fileexchange/34874-interparc. linspace() would not work in that situation. Though for a perfectly straight line like your current situation, Matt's solution is totally accurate.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by