What is wrong with code?

1 次查看(过去 30 天)
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
for i=1:n
b(i,:)=(1:n).^i;
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by