help me loop i cant understand it

for q1 = [1 2 -1;3 0 2] for q2 = [2 1] a = q2*q1; fprintf('the sum of a =%4.2f\n',sum(a)) end end

답변 (1개)

M
M 2018년 3월 30일

0 개 추천

Try this to see if it is gets clear to you:
for q1 = [1 2 -1;3 0 2]
for q2 = [2 1]
a = q2*q1;
fprintf('the sum of (%d %d) and %d is a =%4.2f\n',q1,q2,sum(a))
end
end

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2018년 3월 30일

답변:

M
M
2018년 3월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by