How can i create a vector having 6 values between two numbers
12 次查看(过去 30 天)
显示 更早的评论
How can i create a vector having 6 values between 2 and 12 including the end points 2 and 12?
0 个评论
回答(1 个)
Sindar
2020-10-10
Assuming you want them evenly spaced:
x = linspace(2,12,6);
If you want them randomly spaced
x = [2 ; 2+(12-2)*rand(4,1) ; 12]
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!