开发者

Unitize the columns of matrix

Given a matrix d x n (d-dimensional, n-object) I开发者_开发问答 would like to compute the unit length vector of each columns. (i.e the resultant matrix should have unit length in every column)

how can i do it without looping every column?


I'm assuming you're using the L2 norm. In that case,

normalizedVector = bsxfun(@rdivide,vector,sqrt(sum(vector.^2,1)));

will have unit length along each column.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜