Normalize to unit norm

5 次查看(过去 30 天)
Nuchto
Nuchto 2012-5-27
I have a variable containing a probability distribution (just an one-dimensional array of values). How can I normalize a to unit norm?

采纳的回答

Wayne King
Wayne King 2012-5-27
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 个评论
Nuchto
Nuchto 2012-6-2
Thanks, it works now. What is in lay terms :) the difference between l1 and l2 norm?
Oleg Komarov
Oleg Komarov 2012-6-2
http://en.wikipedia.org/wiki/Norm_%28mathematics%29, Euclidean vs taxicab

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by