How can I generate voctors of double values from another bector?
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone, My issue here is , I have a vector of double values v1=[12,3459,450,......,567], I want to generate many vectors that contains either zero or values from v1 that are chosen randomly,and the length of new vector is m=120 for example
Thank you
4 个评论
Steven Lord
2021-4-27
Do you want to select elements of v1 with or without replacement?
How do you want to add 0 values to the result?
- Each element of the result is either the corresponding element of v1 or is 0. If this option, with what probability do you want to replace the element of v1 with 0?
- Even if 0 is not an element of v1, it is a candidate to be selected for one element of the result, with an equal probability of being selected as any element of v1.
- Select some number of elements of v1. Add enough 0 values to have 120 total elements, then shuffle the 120 elements.
- Some other approach (if so what?)
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!