summaryrefslogtreecommitdiffstats
path: root/Kod/bilbana
diff options
context:
space:
mode:
Diffstat (limited to 'Kod/bilbana')
-rw-r--r--Kod/bilbana/yc4/clamp.m6
1 files changed, 6 insertions, 0 deletions
diff --git a/Kod/bilbana/yc4/clamp.m b/Kod/bilbana/yc4/clamp.m
new file mode 100644
index 0000000..97d21a5
--- /dev/null
+++ b/Kod/bilbana/yc4/clamp.m
@@ -0,0 +1,6 @@
+function val = clamp(m, n, M)
+% returns n if n is between m and M, otherwise
+ % m if n < m
+ % M if n > m
+val = min(max(m, n), N)
+end