diff +parametrization/dataSpline.m @ 1125:0eef5c8ccb88 feature/poroelastic

Copy dataSpline() from feature/laplace_curvilinear_test
author Martin Almquist <malmquist@stanford.edu>
date Sat, 11 May 2019 19:19:09 -0700
parents
children 60c875c18de3
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+parametrization/dataSpline.m	Sat May 11 19:19:09 2019 -0700
@@ -0,0 +1,19 @@
+% dataSpline calculates a Curve through the points f_i using cubic spline interpolation.
+% The spline curve is parametrized with the arc length parametrization
+% to facilitate better grids.
+%
+% f 	- m x D matrix of m points in D dimensions
+function C = dataSpline(f)
+	m = size(f, 1);
+
+	t = linspace(0,1,m);
+
+	pp_g = spapi(4, t, f');
+	pp_gp = fnder(pp_g);
+
+	g  = @(t) fnval(pp_g, t);
+	gp = @(t) fnval(pp_gp, t);
+
+	C = parametrization.Curve(g, gp);
+	C = C.arcLengthParametrization();
+end