How can i create a vector having 6 values between two numbers

10 vues (au cours des 30 derniers jours)
Amjed Bakhsh
Amjed Bakhsh le 10 Oct 2020
Commenté : Amjed Bakhsh le 11 Oct 2020
How can i create a vector having 6 values between 2 and 12 including the end points 2 and 12?

Réponses (1)

Sindar
Sindar le 10 Oct 2020
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]

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by