Simplest way to create a unit vector in Matlab?

I am trying to find the simplest way to create a unit vector with arbitrary number of elements in Matlab.
for example V=[1 1 1 1 1 1 1 1 1]

 Akzeptierte Antwort

if by "unit" vector you means vector where the elements are all 1s
len = 9;
V = ones(1,len)
V = 1×9
1 1 1 1 1 1 1 1 1

Weitere Antworten (0)

Kategorien

Mehr zu Aerospace Blockset finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021b

Tags

Gefragt:

am 18 Sep. 2022

Beantwortet:

am 18 Sep. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by