control.flatsys.BSplineFamily

class control.flatsys.BSplineFamily(breakpoints, degree, smoothness=None, vars=None)[source]

Bases: BasisFamily

B-spline basis functions.

This class represents a B-spline basis for piecewise polynomials defined across a set of breakpoints with given degree and smoothness. On each interval between two breakpoints, we have a polynomial of a given degree and the spline is continuous up to a given smoothness at interior breakpoints.

Parameters
breakpoints1D array or 2D array of float

The breakpoints for the spline(s).

degreeint or list of ints

For each spline variable, the degree of the polynomial between breakpoints. If a single number is given and more than one spline variable is specified, the same degree is used for each spline variable.

smoothnessint or list of ints

For each spline variable, the smoothness at breakpoints (number of derivatives that should match).

varsNone or int, optional

The number of spline variables. If specified as None (default), then the spline basis describes a single variable, with no indexing. If the number of spine variables is > 0, then the spline basis is indexed using the var keyword.

Methods

__call__

Evaluate the ith basis function at a point in time.

eval

Compute function values given the coefficients and time points.

eval_deriv

Evaluate kth derivative of ith basis function at time t.

var_ncoefs

Get the number of coefficients for a variable.

__call__(i, t, var=None)[source]

Evaluate the ith basis function at a point in time.

eval(coeffs, tlist, var=None)[source]

Compute function values given the coefficients and time points.

Parameters
coeffsarray

Basis function coefficient values.

tlistarray

List of times at which to evaluate the function.

varint or None, optional

Number of independent variables represented using the basis. If None, then basis represents a single variable.

Returns
array

Values of the variable(s) at the times in tlist.

eval_deriv(i, k, t, var=None)[source]

Evaluate kth derivative of ith basis function at time t.

See BasisFamily.eval_deriv for more information.

var_ncoefs(var)[source]

Get the number of coefficients for a variable.

Parameters
varint

Variable offset.

Returns
int