sum of products of matrix

1 回表示 (過去 30 日間)
Mate 2u
Mate 2u 2012 年 7 月 17 日
Hi all I have a matrix of size 294x34. I want to to have the products of all rows so I get a 294x1 matrix of all the products of the rows. Then I want to have the single product of all 294 elements.
Now, I want this to work even with zeros. So if zero is in their, I would like to ignore it.

採用された回答

Jan
Jan 2012 年 7 月 17 日
編集済み: Jan 2012 年 7 月 17 日
X = round((rand(294, 34) - 0.5) * 10) / 2.4;
X(X == 0) = 1;
Prow = prod(X, 2);
Pall = prod(Prow);
It is not trivial to find (random) test data, which do not reply Inf or 0 due to over- or underflow.
  1 件のコメント
Mate 2u
Mate 2u 2012 年 7 月 17 日
Thank you Jan

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by