Need help creating a two separate matrices; one matrix is a 5x5 and has ones in columns 1, 3, and 5. The other matrix is also 5x5, but in the elements in the fifth column are equal to the row number that they are on.

2 ビュー (過去 30 日間)
I'm supposed to use loops and/or conditionals to achieve the arrays. I'm not sure where to start; any help is appreciated!
  1 件のコメント
Matt J
Matt J 2019 年 2 月 19 日
編集済み: Matt J 2019 年 2 月 19 日
I'm not sure where to start
The first line will probably be
A=zeros(5)

サインインしてコメントする。

回答 (1 件)

Kevin Phung
Kevin Phung 2019 年 2 月 19 日
if you're looking for hints, check out the functions:
size()
ones()
zeros()
and this documentation on array indexing:

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by