Simplest way to create a unit vector in Matlab?

62 次查看(过去 30 天)
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]

采纳的回答

Bruno Luong
Bruno Luong 2022-9-18
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by