Y(i)=X(i)/||X(i)||2。
e.g.
X =
1 2 3 4
5 6 7 8
X_norm = sqrt( sum(X.^2,1) );
Y = bsxfun(@rdivide, X, X_norm);
--->
X_norm =
5.0990 6.3246 7.6158 8.9443
Y =
0.1961 0.3162 0.3939 0.4472
0.9806 0.9487 0.9191 0.8944
时间: 2024-11-05 11:34:30
Y(i)=X(i)/||X(i)||2。
e.g.
X =
1 2 3 4
5 6 7 8
X_norm = sqrt( sum(X.^2,1) );
Y = bsxfun(@rdivide, X, X_norm);
--->
X_norm =
5.0990 6.3246 7.6158 8.9443
Y =
0.1961 0.3162 0.3939 0.4472
0.9806 0.9487 0.9191 0.8944