Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Statment with

Status
Not open for further replies.

nickibee

Aerospace
Apr 7, 2005
2
Hi

I am new to Mathcad and a bit confused. I am trying to use an if statement to say something like the following:

Code:
Lr(R,gamma,theta):=if(phi(R,gamma,theta)< theta, 2, 10)

where

Code:
phi(R,gamma,theta):= atan(hr/Lg(theta))
Lg(theta):= Ls(theta)*cos(theta)
Ls(theta):= 2*hr/sin(theta)

However it wont work when i try to output the value of
Code:
Lr(R,gamma,theta)=
, I am getting a "must be real" error. If i change the boolean statement in the if statement to
Code:
phi(R,gamma,theta)= theta
it outputs an answer fine, however this is not what i need to work out! Does anyone know why this is?

Thanks in advance
 
Replies continue below

Recommended for you

What values or R, gamma, theta are you using?

TTFN
 
I'm not sure what I've done but it seems to work now! The values of R, gamma and theta vary but in my examples that didnt work R was about 15, gamma was 90 and theta about 0.2. I've been playing around a bit with the algorithms and think I may have been using a variable in the right-hand part of the declaration that I hadn't put as an arguement in the left-hand part, but as this variable was declared at some point above this then it wasn't being picked up as not declared. It may have had an inappropriate value in from another calulation which was causing this. I am not sure though.

Thanks for you reply
 
Bear in mind that the default unit for trig functions in Mathcad is the radian, not degree.

TTFN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor