필터 지우기
필터 지우기

Sttopping the iteration at a certain value

조회 수: 1 (최근 30일)
Tina
Tina 2020년 5월 16일
댓글: Star Strider 2020년 5월 16일
HI!
I have a vector length of 0:0.1:1 and ineed iteration according to this vector length. I have done this part now i need to stop these iteration when valuee of r becomes positive but it doesnt work what should i do.Hve a look on this code.I need the loop to break when real part of poles that is r (any of three values in vectoor) becomes +ive but it doesn;t work.The condition work perfectly for r<0 condition but not for this.plzz help
for k= 0:0.1:1
n=conv(k,[0.5 1.3]);
d=[1 1.2 1.6 0];
sys1=tf(num1,den);
P=pole(F);
r=real(P)
if r>0
break
end
end

채택된 답변

Star Strider
Star Strider 2020년 5월 16일
The ‘F’ variable is apparently defined before the loop and does not appear to be changed within the loop. Therefore, ‘r’ never changes and the if condition is never satisfied.
  댓글 수: 8
Tina
Tina 2020년 5월 16일
OK THANKS
Star Strider
Star Strider 2020년 5월 16일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by