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?

 Réponse acceptée

Birdman
Birdman le 3 Jan 2018
Modifié(e) : Birdman le 3 Jan 2018

0 votes

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

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by