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: Simulink evaluation of (a<b) ? (a*a/b) : b
Replies: 6   Last Post: Apr 17, 2012 4:35 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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?



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.