Please note that the recommended version of Scilab is 2026.0.0. This page might be outdated.
See the recommended documentation of this function
interp
3次スプライン評価関数
呼び出し手順
[yp [,yp1 [,yp2 [,yp3]]]]=interp(xp, x, y, d [, out_mode])
引数
- x,y
同じ大きさ
nの実数ベクトル: 補間および関連する3次スプライン (以下,s(X)と呼びます)または サブスプライン関数を定義します.- d
size(x)の実数ベクトル: 微分 s'(x). 多くの場合, s'(x) は関数splin(x, y,..)により 適当に推定されます.
- out_mode
(オプション)
の外側で.
Xに対するs(X)を定義します. 利用可能な値: "by_zero" | "by_nan" | "C0" | "natural" | "linear" | "periodic"- xp
実数ベクトルまたは行列:
Yが未知の座標で,s(xp)で推定されます- yp
size(xp)のベクトルまたは行列:
yp(i) = s(xp(i))またはyp(i,j) = s(xp(i,j))- yp1, yp2, yp3
size(x) のベクトル(または行列): 微分
s'(xp),s''(xp)およびs'''(xp)の要素毎の評価.
説明
指定した点の(x,y) 集合を補間する3次スプライン関数 s(X)
は,
の範囲で定義された,連続で微分可能な関数です.
これは,3次元多項式の集合からなり,その各々は
が
で定義され,
隣接する多項式と値と傾きで接続されています.
つまり,
の各々について,
を記述できます.




out_modeパラメータは
補外,すなわち,xp(i)が
の範囲にない場合
の評価規則を設定します :
- "by_zero"
0による補外が行われます
- "by_nan"
Nan (%nan)による補外
- "C0"
以下のように定義される補外 :


- "natural"
以下のように定義される補外 (
は,
においてs(X)を定義する多項式です)

- "linear"
補外は以下のように定義されます :


- "periodic"
sは周期性により拡張されます.![yp_i = s( x_1 + ( (xp_i-x_1)\ \mbox{modulo}\ [x_n-x_1] ) )](/docs/6.0.2/ja_JP/_LaTeX_interp.xml_20.png)
例
// splin および lsq_splinの例を参照 // スプラインおよびサブスプラインの C2およびC1連続性を示す例 a = -8; b = 8; x = linspace(a,b,20)'; y = sinc(x); dk = splin(x,y); // not_a_knot df = splin(x,y, "fast"); xx = linspace(a,b,800)'; [yyk, yy1k, yy2k] = interp(xx, x, y, dk); [yyf, yy1f, yy2f] = interp(xx, x, y, df); clf() subplot(3,1,1) plot2d(xx, [yyk yyf]) plot2d(x, y, style=-9) legends(["not_a_knot spline","fast sub-spline","interpolation points"],... [1 2 -9], "ur",%f) xtitle("spline interpolation") subplot(3,1,2) plot2d(xx, [yy1k yy1f]) legends(["not_a_knot spline","fast sub-spline"], [1 2], "ur",%f) xtitle("spline interpolation (derivatives)") subplot(3,1,3) plot2d(xx, [yy2k yy2f]) legends(["not_a_knot spline","fast sub-spline"], [1 2], "lr",%f) xtitle("spline interpolation (second derivatives)")
// 異なる補外の方法を示す例 x = linspace(0,1,11)'; y = cosh(x-0.5); d = splin(x,y); xx = linspace(-0.5,1.5,401)'; yy0 = interp(xx,x,y,d,"C0"); yy1 = interp(xx,x,y,d,"linear"); yy2 = interp(xx,x,y,d,"natural"); yy3 = interp(xx,x,y,d,"periodic"); clf() plot2d(xx,[yy0 yy1 yy2 yy3],style=2:5,frameflag=2,leg="C0@linear@natural@periodic") xtitle(" different way to evaluate a spline outside its domain")

履歴
| バージョン | 記述 |
| 5.4.0 | 以前では, 入力引数の虚部は暗黙のうちに無視されていました. |
| Report an issue | ||
| << eval_cshep2d | Interpolation | interp1 >> |