m = pwAddU(m, *ID, *uType, *uTimes, *uValues, compartment, name, ...
           description, u2Values, alternativeIDs, designerProps, ...
           classname, referenceXID, unit, uFormula)
 m = pwAddU(m, interactive)

 Adds a driving input to a model.


Arguments for pwAddU

 m              struct          Model struct
 ID             ID              ID of the driving input.
                                In case of an injection input, this ID must coincide
                                with the ID of the corresponding x variable.
 uType          string          'steps', 'linear', 'spline', 'logistic', 'injection'
                or int          1        2         5         6           7
 uTimes         float vector    time values
 uValues        float vector    step values
 compartment    ID
 name           string          descriptive name
 description    string
 u2Values       float vector    second derivative if available (see below)
 alternativeIDs cell array
 designerProps  matrix          Visualization properties (12 entries per row):
                                [x y z w h color isFlippedX isFlippedY isUpright isVisible;
 classname      string          Custom class name of the variable to define its shape
                                in the model designer and to group related variables.
                                For Systems Biology models (compare CellDesigner):
                                'protein.generic', 'protein.receptor',
                                'protein.ion_channel', 'protein.truncated',
                                'gene','rna' 'antisense_rna', 'phenotype',
                                'simple_molecule', 'drug', 'unknown', 'complex',
                                'ion', 'degraded'
 referenceXID   ID              Only used for injection inputs:
                                x1(t) = x2(t) + uValues(t), where x1 is the variable with the
                                same ID as the driving input and x2 is given by the
                                referenceXID. Usually x1 and x2 denote the same variable (default),
                                corresponding to an increase of x1 by uValues(t) at time t.
                                However, in order to 'copy' the value of another variable,
                                it can be useful to have the flexibitiy to specify x2 separately.
                                Please use the uFormula 'u' (see below), if x1 should be
                                set to uValues(t), i.e. x1(t) = uValues(t).
 unit           string
 uFormula       string          Only used for injection inputs. The formula may contain parameter IDs.
                                Two tokens are reserved: "x" and "u". They will be replaced with
                                the current value of the reference X species and the amount u
                                to be injected. Examples:
                                'x + u' (default):
                                x1(t) is set to x2(t) + uValues(t)
                                x1(1) is set to uValues(t)
                                'x + u/2'
                                x1(t) is set to x2(t) + uValues(t)/2
                                x1(t) is set to x2(t)/2
                                x1(t) is set to 0.
                                'u / V'
                                x1(t) is set to uValues(t) divided by parameter V.

 Alternative function call for interactive specification:
 interactive   bool    If true, the user is prompted to enter the properties
                       into a user interface.



 Some players like the ligand concentration may be controlled
 externally and are represented in the model definition file as
 driving inputs. Linear, step, and exponential interpolations are supported.
 Alternatively, injections can be used if the player should take
 part as a normal substance in the dynamic system, but is increased
 at certain time points by a given amount - like an IV-bolus.

 A step input corresponds to a 'piecewise' function, which can also
 be used within PottersWheel. However, PottersWheel is optimized for
 driving inputs, so the 'piecewise' function should be avoided if possible,
 i.e. for all time-dependent piecewise expressions.




Cubic spline

 Values (uValues) and second derivatives (uValues2) of the spline have to
 be specified for all knots (uTimes) to define a cubic spline as described
 in the Numerical Recipes, section 3.3 (Cubic spline interpolation).

 v  = value of spline
 v2 = second derivative of spline

  h = t[right] - t[left];'; % right and left are the indeces around time of interest tt
  a = (t[right] - tt) / h;';
  b = (tt - t[left]) / h;';
  interpolated_value_at_tt = a * v[left] + b * v[right] + ...
                            ((a*a*a - a) * v2[left] + ...
                            (b*b*b-b) * v2[right]) * (h*h) / 6.0;';



 A step input of ligand 'L' starting at t=-100 at level 0,
 jumping at t=0 to 5 and decreasing at t=10 to level 2:

 m = pwAddU(m, 'L', 'steps', [-100 0 10], [0 5 2]);

See also