help me loop i cant understand it

1 Ansicht (letzte 30 Tage)
George Georgy
George Georgy am 30 Mär. 2018
Beantwortet: M am 30 Mär. 2018
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

Antworten (1)

M
M am 30 Mär. 2018
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

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by