Mercurial > repos > public > sbplib
comparison +parametrization/dataSpline.m @ 1112:835c8fa456ec feature/timesteppers
Merge with default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 10 Apr 2019 22:22:46 +0200 |
parents | 36d092a00040 |
children | 60c875c18de3 |
comparison
equal
deleted
inserted
replaced
1111:1a265a376b36 | 1112:835c8fa456ec |
---|---|
1 % dataSpline calculates a Curve through the points f_i using cubic spline interpolation. | |
2 % The spline curve is parametrized with the arc length parametrization | |
3 % to facilitate better grids. | |
4 % | |
5 % f - m x D matrix of m points in D dimensions | |
6 function C = dataSpline(f) | |
7 m = size(f, 1); | |
8 | |
9 t = linspace(0,1,m); | |
10 | |
11 pp_g = spapi(4, t, f'); | |
12 pp_gp = fnder(pp_g); | |
13 | |
14 g = @(t) fnval(pp_g, t); | |
15 gp = @(t) fnval(pp_gp, t); | |
16 | |
17 C = parametrization.Curve(g, gp); | |
18 C = C.arcLengthParametrization(); | |
19 end |