필터 지우기
필터 지우기

Normalize to unit norm

조회 수: 6 (최근 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