Normalize to unit norm
6 views (last 30 days)
Show older comments
I have a variable containing a probability distribution (just an one-dimensional array of values). How can I normalize a to unit norm?
0 Comments
Accepted Answer
Wayne King
on 27 May 2012
If you want to normalize a vector to have unit L2 norm.
x = randn(100,1);
x = x./norm(x,2);
norm(x,2)
12 Comments
Oleg Komarov
on 2 Jun 2012
http://en.wikipedia.org/wiki/Norm_%28mathematics%29, Euclidean vs taxicab
More Answers (0)
See Also
Categories
Find more on Random Number Generation 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!