The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

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
Re: Simulink evaluation of (a<b) ? (a*a/b) : b
Posted: Apr 17, 2012 3:04 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> I "know nuthink" about Simulink per se, but why not just special case
> b==0, too?

I can't special-case anything without using a conditionally-executing subsystem (I don't want to go there... if you care, see or a MATLAB function evaluation (slow). It's not just a matter of simply doing an "if" statement. I can use min() and max() because they are predefined functions with no branches (or rather, the branches are taken care of inside the blocks).

> I presume a>=0 must also be a reqm't or the branch a^2/b could be taken
> for b=0 legitimately...

Yes, a and b are both within the range [0,1] inclusive.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.