Normalize to unit norm

4 ビュー (過去 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 件)

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by