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

16 visualizaciones (últimos 30 días)
Amjed Bakhsh
Amjed Bakhsh el 10 de Oct. de 2020
Comentada: Amjed Bakhsh el 11 de Oct. de 2020
How can i create a vector having 6 values between 2 and 12 including the end points 2 and 12?

Respuestas (1)

Sindar
Sindar el 10 de Oct. de 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]

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by