gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/examples/interp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/interp.lua')
-rw-r--r--examples/interp.lua 14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/interp.lua b/examples/interp.lua
new file mode 100644
index 00000000..f0a0d013
--- /dev/null
+++ b/examples/interp.lua
@@ -0,0 +1,14 @@
+function demo1()
+ local N = 8
+ local xsmp = |k| 2*pi*(k-1)/N
+ local x, y = new(N, 1, xsmp), new(N, 1, |k| sin(xsmp(k)))
+ local p = plot 'interp'
+ p:show()
+ p:addline(xyline(x, y))
+ local ap = interp('akima', x, y)
+ p:addline(fxline(|x| ap:eval(x), 0, 2*pi), 'blue', {{'dash', 7, 3, 3, 3}})
+ return p, ap
+end
+
+print 'demo1() - Akima interpolation of simple sine data'
+
generated by cgit v1.2.3 (git 2.25.1) at 2025年10月01日 08:24:25 +0000

AltStyle によって変換されたページ (->オリジナル) /