How to manipulate the vector prob5 = rand(1,6) to create a new vector of values that range from 10 through 20?
3 次查看(过去 30 天)
显示 更早的评论
How to manipulate the vector prob5=rand(1,6) to create a new vector of values that range from 10 through 20?
0 个评论
回答(1 个)
Image Analyst
2015-11-25
it's just very simple algebra:
prob5=rand(1,6)
minp = min(prob5)
maxp = max(prob5)
out = 10 + 10 * (prob5 - minp) / (maxp-minp)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation of 2-D Selections in 3-D Grids 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!