Skip to content

integrate_t.m

Basic Information

  SYNTAX:  integral_t = integrate_t(data,time,t1,t2,IC,deltat,method)

  PURPOSE:  Calculate indefinite integral of data from t1 to t (approx.) on
        interval [t1,t2].

  INPUT:
    data = data to integrate (if more than one data vector, time vector
            must correspond to increasing row number)
    time = time corresponding to data
    t1   = lower limit of integration
    t2   = upper limit of integration
    IC   = initial condition vector, size=1 x (# columns of data)
         (optional, default=0)
    deltat = fixed sampling rate (optional)
    method = set to 0 for rectangular (faster), 1 for trapezoidal (default)

  OUTPUT:
    integral_t = vector defined on time vector representing (approximately)
         integral of function data(t) from t1 to t.

  RESTRICTIONS: Right now, requires FIXED sampling rate. Can be upgraded
    to handle multiple time domains with some work.

  METHOD:  Uses trapezoidal integration.  (Assumes linear interpolation
        between samples.)

Dependencies