필터 지우기
필터 지우기

Info

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

How can I solve this loop?

조회 수: 2 (최근 30일)
maria
maria 2013년 11월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
I have the following:
R=[-0.1 0 0.1 0.2 0.3 0.4]
Length=20;
theta=(P_hight-Diam)/Length;
for i=1:1:5;
if R(i)>0 & R(i)>theta;
M(i)=1;
end
end
a1=sum(M);
When I make my Length bigger a1 also increase. I would like to make a loop which give me the minimum Length where a is the bigger.
Can some one help me?
  댓글 수: 1
Wayne King
Wayne King 2013년 11월 26일
Can you please clarify what you want. Increasing Length will reduce the value of theta and therefore I'm not surprised that M would have more nonzero entries and the sum would be larger.

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by