Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 3 condition in IF statement
Replies: 16   Last Post: Aug 1, 2013 12:52 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Babak

Posts: 9
Registered: 7/12/13
3 condition in IF statement
Posted: Jul 30, 2013 3:40 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi everybody. I have program which 3 condition should be compare. I want this IF statement to be true only in the case where the first condition AND the second condition AND the third condition are all true simultaneously.
Thanks a lot

clc
clear all
f1=3;f2=3;THD=2;
if ((0>=f1<=2) && (4>=f2<=5) && (1>=THD<=6))
disp('Normal)')
elseif (0>=f1<=3) && (1>=f2<=5) && (1>=THD<=6)
disp('Sag')
end

In this program it will always shows "Normal" because of the last condition (1>=THD<=6)!
Where I went wrong?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.