×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Help with IF statements

Help with IF statements

Help with IF statements

(OP)
How to I write the following in MathCAD?

If Pr >= 0.51 and Pr <= 0.7 then Scf = 2.4 + ((Pr-0.51)^3 * (3.82))



If Pr ? 0.70 then Scf = 3.125 + ((Pr-0.7) * (8.25))

Thanks,
CadLady

RE: Help with IF statements

The IF statement uses a the syntax IF(a,b,c).

If a is true then the returned value is b, else the returned value is c.

For example:

Scf:=If((Pr>=0.51)*(Pr<=0.7),((Pr-0.51)^3*(3.82)),(3.125+((Pr-0.7)*(8.25))))

For AND and OR operators mulriply or add boolean operators, the example abocve shows an AND operator

(Pr>=0.51)*(Pr<=0.7)= (Pr>=0.51) AND (Pr<=0.7)

where as

(Pr=0.51)+(Pr=0.7)= (Pr=0.51) OR (Pr=0.7)

Hope this helps.

Fawkes

RE: Help with IF statements

Another way to write conditional statements is as follows:

Write 'Scf:=' then press '}' (curly bracket) this will open a conditional object. Write the answer then press SHIFT+} to start the conditional statement (MatchCAD should automatically write ' if '). Use the arrow keys to move between different rows in the equation.

Any problems check out the help for Conditional Statements.


Fawkes

RE: Help with IF statements

Possible correction to Fawkes post. You need a "]" square bracket after scf:=.  The keystrokes then become scf:]answer}condition.

What do you mean by "pr?0.7".  Is the "?" supposed to be <,=, or >?

More help to follow when I know what this means...

Imagineer

RE: Help with IF statements

Imaganeer,

Quite right, sorry, press the square bracket first.

Fawkes

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources