Finding the product within an interval
1 次查看(过去 30 天)
显示 更早的评论
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)?
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!