How would I create this matrix
X= 1/2
0
0
0
0
0
0
0
0
0
In this case n=10. Is there a way to make this matrix where n=100, where the first entry is 1/2 and the rest are zeros

回答 (1 件)

Stephen23
Stephen23 2018 年 2 月 23 日

0 投票

Or in one line:
[1/2;zeros(n-1,1)]

カテゴリ

ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索

質問済み:

2018 年 2 月 23 日

回答済み:

2018 年 2 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by