I want a matrix as follows:
n = 12
b = zeros(n,n)
b(1,:) = 1:n
b(2,:) = 1:n.^2
etc...
How can I express that in a loop form?

 採用された回答

Birdman
Birdman 2018 年 1 月 3 日
編集済み: Birdman 2018 年 1 月 3 日

0 投票

for i=1:n
b(i,:)=(1:n).^i;
end

その他の回答 (0 件)

カテゴリ

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

製品

質問済み:

2018 年 1 月 3 日

編集済み:

2018 年 1 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by