Normalize vector in 3D space

10 views (last 30 days)
Jennifer Fayad
Jennifer Fayad on 25 Jan 2019
Answered: John D'Errico on 26 Jan 2019
Hello,
I'm trying to normalize a vector in 3d space into a unit vector

Answers (2)

Matt J
Matt J on 25 Jan 2019
Edited: Matt J on 25 Jan 2019
X= v./sqrt( sum(v.^2,2) );

John D'Errico
John D'Errico on 26 Jan 2019
V = V./norm(V);
The default for norm is the 2-norm, so what you want.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!