The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Modeling >> Behavioral Models >> Clamping Function https://designers-guide.org/forum/YaBB.pl?num=1676993139 Message started by cookacounty on Feb 21st, 2023, 7:25am |
Title: Clamping Function Post by cookacounty on Feb 21st, 2023, 7:25am Is there a mathematical function anyone would recommend to clamp a value between two limits? Using an "if" statement is obviously a bad idea. For example you have a voltage "Vlim" that you want to clamp between -2 and +2. The function would do essentially nothing until the limits. |
Title: Re: Clamping Function Post by cookacounty on Feb 21st, 2023, 11:48am Seems like a "soft limiter is the solution. I notice it still has if statements but is continuous around them so maybe that's okay Code:
Code:
|
Title: Re: Clamping Function Post by cookacounty on Feb 21st, 2023, 12:18pm In a function format for use with "real" datatypes: Code:
|
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |