annotate +parametrization/dataSpline.m @ 1198:2924b3a9b921 feature/d2_compatible

Add OpSet for fully compatible D2Variable, created from regular D2Variable by replacing d1 by first row of D1. Formal reduction by one order of accuracy at the boundary point.
author Martin Almquist <malmquist@stanford.edu>
date Fri, 16 Aug 2019 14:30:28 -0700
parents 36d092a00040
children 60c875c18de3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1098
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
1 % dataSpline calculates a Curve through the points f_i using cubic spline interpolation.
1089
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2 % The spline curve is parametrized with the arc length parametrization
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 % to facilitate better grids.
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
4 %
1098
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
5 % f - m x D matrix of m points in D dimensions
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
6 function C = dataSpline(f)
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
7 m = size(f, 1);
1089
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8
1098
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
9 t = linspace(0,1,m);
1089
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10
1098
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
11 pp_g = spapi(4, t, f');
1092
47a72344db71 Bugfix in dataSpline(), reparameterize with parameter from 0 to 1 before using Curve.
Martin Almquist <malmquist@stanford.edu>
parents: 1091
diff changeset
12 pp_gp = fnder(pp_g);
1089
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13
1098
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
14 g = @(t) fnval(pp_g, t);
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
15 gp = @(t) fnval(pp_gp, t);
1089
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17 C = parametrization.Curve(g, gp);
1098
36d092a00040 Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
Martin Almquist <malmquist@stanford.edu>
parents: 1093
diff changeset
18 C = C.arcLengthParametrization();
1089
d7f6c10eab13 Add function parametrization/dataSpline which accepts data points and returns a Curve object consisting of a spline interpolant with the arclength parametrization.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 end