Normalize to unit norm
5 次查看(过去 30 天)
显示 更早的评论
I have a variable containing a probability distribution (just an one-dimensional array of values). How can I normalize a to unit norm?
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!