Last active
January 4, 2020 15:23
-
-
Save jpcima/f647105ea46360122c661fd6e46f1e91 to your computer and use it in GitHub Desktop.
Asymmetric soft clipper with parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# license CC0-1.0 or MIT | |
cubic(x)=(x*x*x/3) | |
lm(k)=-sqrt(k*k*k)/(k*k*k) # the local minimum | |
kubic(k,x)=x-cubic(k*x) | |
max(a,b)=(a>b)?a:b | |
nl(k,x)=(x>0)?x:kubic(k,max(x,lm(k))) | |
set xrange [-1:+1] | |
plot nl(1.0,x), nl(1.25,x), nl(1.5,x), nl(1.75,x), nl(2.0,x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment