Simplest way to create a unit vector in Matlab?

117 ビュー (過去 30 日間)
Mehdi
Mehdi 2022 年 9 月 18 日
回答済み: Bruno Luong 2022 年 9 月 18 日
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 Center および File ExchangeGet 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