Finding the product within an interval

1 回表示 (過去 30 日間)
Noah Kebschull
Noah Kebschull 2017 年 11 月 19 日
コメント済み: Noah Kebschull 2017 年 11 月 19 日
I have 250 element row vector of random numbers between intervals (-4.5, 5.5). Once I create that vector, how would I find the product of all elements between intervals (2.3, 2.6)?

採用された回答

Roger Stafford
Roger Stafford 2017 年 11 月 19 日
編集済み: Roger Stafford 2017 年 11 月 19 日
If v is your vector of random numbers, do this:
p = prod(v(v>=2.3 & v<=2.6)); % The desired product
  1 件のコメント
Noah Kebschull
Noah Kebschull 2017 年 11 月 19 日
That worked, thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by