Borrar filtros
Borrar filtros

What is wrong with code?

2 visualizaciones (últimos 30 días)
GEORGIOS BEKAS
GEORGIOS BEKAS el 3 de En. de 2018
Editada: Birdman el 3 de En. de 2018
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?

Respuesta aceptada

Birdman
Birdman el 3 de En. de 2018
Editada: Birdman el 3 de En. de 2018
for i=1:n
b(i,:)=(1:n).^i;
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by