フィルターのクリア

sum of random matrix = to zero

3 ビュー (過去 30 日間)
Offroad Jeep
Offroad Jeep 2015 年 4 月 16 日
コメント済み: Offroad Jeep 2015 年 7 月 31 日
Dear All,
I want to generate a=6 X 6 random matrix but the sum(sum(a)) = zero. Help in this regard will be highly appreciated........
Regards..........
  2 件のコメント
Roger Stafford
Roger Stafford 2015 年 4 月 16 日
If you did not have the condition that the sum of the 36 numbers be zero, what would you have the distribution of these numbers be? Also are they integers or just any real numbers? What is their allowable range?
Offroad Jeep
Offroad Jeep 2015 年 7 月 31 日
The numbers can be integers and real numbers too..........

サインインしてコメントする。

回答 (1 件)

Roger Stafford
Roger Stafford 2015 年 4 月 16 日
As was pointed out in your previous query, "sum of all anges is zero", one solution is to use 'randfixedsum' in the file exchange at:
http://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum
It was designed just for this kind of problem.
  1 件のコメント
John D'Errico
John D'Errico 2015 年 4 月 17 日
You don't need to write the code. Just use it to generate 36 numbers with a sum of zero. Once you have that, then use reshape to make it a 6x6 array.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by