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 Exchange에서 Loops 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