comparison +parametrization/dataSpline.m @ 1106:00203fcc962f

Merged in feature/dataspline (pull request #14) Feature/dataspline Approved-by: Jonatan Werpers <jonatan.werpers@it.uu.se> Approved-by: Martin Almquist <malmquist@stanford.edu>
author Martin Almquist <malmquist@stanford.edu>
date Tue, 09 Apr 2019 20:24:21 +0000
parents 36d092a00040
children 60c875c18de3
comparison
equal deleted inserted replaced
1096:78d7e4e28e3e 1106:00203fcc962f
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