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" function with undefined "OTHERWISE" item?

Status
Not open for further replies.

Briscoz

Computer
Mar 26, 2008
3
Hi,
Please, could you help me? I have problem with "IF" function. I have function named "f1" and "f2".
f1:=0..10
f2:=0..10
Sum of these function cannot be greater that 10. If the sum is greater, then function is undefined.

I tried do that by the help of the "IF" function.
if(f1+f2<10,f1+f2,0)
But there is "OTHERWISE" item. I use "0", but would like to use "UNDEFINED", or something like that.

It is possible to do that?

Thanks
 
Replies continue below

Recommended for you

You can specific a text output using UNDEFINED in quotes.

TTFN

FAQ731-376
 
But the funcion won't work because you can't compare the results of adding two range variables to a scalar. Try creating a vector and comparing each element.
 
What you may be looking for is NaN (no quotes), which will define a result as Not a Number.


Peter
 
Bizcoz,
Unfortunately you don't have what you think you have.
As written, what you have is two range variables - these are implied for loops.

You can assign NaN (Not a Number) to a result to indicate undefined.

I presume you are doing 'numeric' calculations rather than fancy formula manipulation (symbols).

f1(a):=a
f2(b):=b
[f1, f2 not really needed]

F3(a,b):=if(a+b>10,NaN,a+b)

Philip
Stick a work sheet on for more replies
 
One possibility would be to set the "undefined" value to something out of range, then manually set your z axis so this range is not shown. For instance in your plot on the upper left: set the undefined value to be -1 (rather than 0), then left click the graph, select properties, uncheck auto scale z axis, then set the z axis limits to 0 and 10.

Peter
 
If you save as V11 format (.mcd) then more folk can read it.

There are still a large community who are sticking at V11 until V14/15 becomes more stable and efficient.

V14 is good for pro/e integration but still has a couple of rough edges for those using symbolics [has new MuPad engine].

Philip
 
I'm getting a set of plots in V11.

What am I looking for that isn't working?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor