% [tRoot, vRoot, ppx, ppv] = getPchipRoots(t,x)
% This function computes a PCHIP spline through the data set x(t) and then
% finds the roots of the spline.
% t = [1,n] = monotonically increasing vector of time stamps
% x = [1,n] = data at each time stamp = x(t)
% tRoot = [1,k] = monotonically increasing vector corresponding to the
% time at which each root occurs. Empty if no roots exist.
% vRoot = [1,k] = derivative of the interpolant at each of the roots.
% ppx = Matlab pp-form (PCHIP) spline that interpolates x(t)
% ppv = Matlab pp-form spline that is the derivative of x(t)
% -- roots are computed numerically using Ridder's Method.