Navigation

Operators and Keywords

Function List:

C++ API

Function File: [ dotx, dotxdx, u] = nloscillator (t, x, opt)

Implements a general nonlinear oscillator.

          q'' + p(q) + g(q') = f(t,q,q')

where q is the configuration of the system and p(q), g(q') are homogeneous polynomials of arbitrary degree.

                  P
          p(x) = sum a_i q^i,
                 i=1
                   G
          g(x') = sum a_i (q')^i,
                  i=1

This function can be used with the ODE integrators.

INPUTS

t: Time. It can be a scalar or a vector of length nT.

x: State space vector. An array of size 2xnT, where nT is the number of time values given. The first row corresponds to the configurations of the system and the second row to its derivatives with respect to time.

opt: An options structure. See the complementary function setnloscillator. The structure containing the fields:

Coefficients: Contains a vector of coefficients for p(x). It follows the format used for function ppval opt.Coefficients(i) = a(P+1-i).

Damping: Contains a vector of the coefficients for g(x'). Same format as before.

Actuation: An optional field of the structure. If it is present, it defines the function f(t,q,q'). It can be a handle to a function of the form f = func(t, x, opt) or it can be a 1xnT vector.

OUTPUT

dotx: Derivative of the state space vector with respect to time. A 2xnT array.

dotxdx: When requested, it contains the Jacobian of the system. It is a multidimensional array of size 2x2xnT.

u: If present, the function returns the inputs that generate the sequence of state space vectors provided in x. To do this the functions estimates the second derivative of q using spline interpolation. This implies that there be at least 2 observations of the state vector x, i.e. nT >= 2. Otherwise the output is empty.