Why do I get this result??
이전 댓글 표시
Hello
I have a problem with this code
k=2*A+3*B
if k<3.65
fr='inf'
elseif 3.65<k<=4.35
fr='moy'
elseif k>4.35
fr='sup'
end
why i get this result 'moy'?? it must be 'sup'
k =
6.4582
fr =
moy
Can you help me to correct this code.
채택된 답변
추가 답변 (2개)
David Barry
2012년 11월 7일
Try this
k=2*A+3*B
if k<3.65
fr='inf'
elseif k >= 3.65 && k<= 4.35
fr='moy'
elseif k>4.35
fr='sup'
end
댓글 수: 3
David Barry
2012년 11월 7일
Looks like Evan beat me to it. && is MATLAB command for logical AND.
David Barry
2012년 11월 7일
Also note that I have changed your code to cope when k = 3.65
Evan
2012년 11월 7일
Good catch. I didn't notice that. I've updated my post to account for that issue, but credit goes to you. :)
카테고리
도움말 센터 및 File Exchange에서 Filter Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!