All possible answers in for loop

조회 수: 1 (최근 30일)
Shay Shah
Shay Shah 2021년 3월 14일
편집: Walter Roberson 2021년 3월 15일
I am trying to get all possible answers for this equation with this code, but it doesnot give all 10^5 answers. any suggestion?
for i=7:16
for j=7:16
for k=7:16
for m=7:16
for n=7:16
l=(53019916.69*i)+(53019916.69*j)+(36067.97054*k)+(468883.617*m)+(468883.617*n);
display(l)
end
end
end
end
end
  댓글 수: 5
Adam Danz
Adam Danz 2021년 3월 14일
Shay Shah's comment is replaced with an abbreviated version below that avoids a very long scroll to the bottom.
it assumes only 10:11 I think my answers are like this:
l =
1.6526e+09
l =
1.6531e+09
% etc...
Walter Roberson
Walter Roberson 2021년 3월 15일
편집: Walter Roberson 2021년 3월 15일
If you need to work with them afterwards, then I would imagine that you would want to store them instead of displaying them.
for i=1:10
for j=1:10
output(i, j) = 3*(i+6) + 5*(j+6);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by