Simplest way to create a unit vector in Matlab?

118 visualizaciones (últimos 30 días)
Mehdi
Mehdi el 18 de Sept. de 2022
Respondida: Bruno Luong el 18 de Sept. de 2022
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]

Respuesta aceptada

Bruno Luong
Bruno Luong el 18 de Sept. de 2022
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

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by