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?

 Accepted Answer

Birdman
Birdman on 3 Jan 2018
Edited: Birdman on 3 Jan 2018
for i=1:n
b(i,:)=(1:n).^i;
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Asked:

on 3 Jan 2018

Edited:

on 3 Jan 2018

Community Treasure Hunt

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

Start Hunting!