Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Simulink evaluation of (a<b) ? (a*a/b) : b
Replies: 6   Last Post: Apr 17, 2012 4:35 PM

 Messages: [ Previous | Next ]
 Jason S Posts: 57 Registered: 2/23/05
Simulink evaluation of (a<b) ? (a*a/b) : b
Posted: Apr 17, 2012 2:39 PM

I posted on StackOverflow (http://stackoverflow.com/questions/10196654/simulink-numerical-evaluation-to-prevent-overflow) but figured I'd ask here as well:

I have this function

f(a,b) = {
a*a/b if a < b,
b if a >= b
}

defined for values of a and b between 0 and 1 inclusive.

The function is continuous at all valid values of a and b in this range. (Really! try it yourself!) But I'm not sure how to evaluate it in Simulink. The problem is that I can't figure out how to restate it in a way that I could evaluate both "forks" of the function and take the min or max (e.g. min(a*a,b*b)/b) without having a divide-by-zero error at b=0, and I'd like to avoid getting into things like conditionally-executed subsystems.

Does anyone know how I might go about doing this?

Date Subject Author
4/17/12 Jason S
4/17/12 dpb
4/17/12 Jason S
4/17/12 dpb
4/17/12 Phil Goddard
4/17/12 Kate
4/17/12 Jason S