フィルターのクリア

normalize a row vector

1 回表示 (過去 30 日間)
Elysi Cochin
Elysi Cochin 2014 年 3 月 3 日
i have a vector of size A = 1*128.... i wanted to normalize the vector to B, such that when i sum the new matrix B, i get its sum of all column values as 1....
is there any method to do it?... please do reply....

採用された回答

Niklas Nylén
Niklas Nylén 2014 年 3 月 3 日
B = A./sum(A);

その他の回答 (1 件)

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2014 年 3 月 3 日
If I understood correctly:
A=1:128;
B=A/sum(A);
Then:
sum(B)
ans =
1

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by