Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

A for loop need help ASAP

조회 수: 1 (최근 30일)
Nikolaos Zafirakis
Nikolaos Zafirakis 2019년 4월 30일
마감: Stephen23 2019년 4월 30일
I have a loop and I want to collect the output?
A are arrays 0:300
for i = 0:3:300
Fi = atan(-(A5(1,1+i)/A5(1,2+i)));
Theta = acos(A5(1,3+i));
Psi = atan(A3(1,3+1)/A4(1,3+i));
end

답변 (1개)

Torsten
Torsten 2019년 4월 30일
편집: Torsten 2019년 4월 30일
for i = 0:3:300
j = i/3 + 1;
Fi(j)= atan(-(A5(1,1+i)/A5(1,2+i)));
Theta(j) = acos(A5(1,3+i));
Psi(j)= atan(A3(1,3+i)/A4(1,3+i));
end
  댓글 수: 2
Nikolaos Zafirakis
Nikolaos Zafirakis 2019년 4월 30일
Thanks for the reply, but it errors and says array indices must be positive integers or logical values!
Torsten
Torsten 2019년 4월 30일
j = 0;
for i = 0:3:300
j = j + 1;
Fi(j)= atan(-(A5(1,1+i)/A5(1,2+i)));
Theta(j) = acos(A5(1,3+i));
Psi(j)= atan(A3(1,3+i)/A4(1,3+i));
end

태그

Community Treasure Hunt

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

Start Hunting!

Translated by