3.2. DATAOBJECTS 75
Appending and Merging Data
Time functions, for creating simulation inputs for example, can be created by combining
pdms. Xmath has two such core functions: concatseg and insertSeg The concatseg
appends the data of one pdm to another. The domain is reca lculatedsuch that it is
always regular. The user can specify a new beginning value for the domain and the
spacing is determined by a series of prioritized rules. insertSeg inserts the data from
one pdm into another. It can also “insert” before the beginning, or after the end, of the
first pdm and the resulting gap is filled with zeros. Again the domain of the result is
recalculated from a user specified beginning and is always regular. Both of these
functions are useful in creating time domain waveforms.
In the typical robustcontrol cases where we want to merge pdm data, the result will not
have a regular domain. One example is merging experimental transfer function estimates
from multiple experiments, prior to performing a least squares transfer function fit or
error analysis. For this purpose, Xµprovides a mergeseg function. Keywords allow the
user to specify whether to sort in ascending or descending order or even whether to sort
at all. The following example illustrates the a typical use.
# pdm1 and pdm2 have identical row and column
# dimensions and at least some non matching
# independent variables
pdm3 = mergeseg(pdm1,pdm2,{ascending,!duplicates})
As an aside, note that the sort function in Xmath sorts each columnof each matrix in a
pdm, rather than sorting the domain.
Extracting Data by Independent Variable/Domain
It is often useful to be able to extract a segment of matrix data from a pdm.The
function extractseg performs this function. The user has the option of resetting the
domain to a new starting value.
# sys1g is a freq. response from 0.1 to 100 rad/sec
# select data from 1 to 10 rad/sec as sys1g1
sys1g1 = extractseg(sys1g,1,10)