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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeAerospace Blockset についてさらに検索

製品

リリース

R2021b

タグ

質問済み:

2022 年 9 月 18 日

回答済み:

2022 年 9 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by