Representing Data in MATLAB Workspace
TimeDomain Data Representation
Timedomain data consists of one or more input variables u(t) and one or more output variables y(t), sampled as a function of time. If there is no input variable, see TimeSeries Data Representation.
You can organize timedomain input/output data in one of three data types:
A
timetable
that contains a time variable and any number of input and output channel variablesA pair of numeric matrices that contain the input and output data separately
An
iddata
object that contains properties such as input and output data, sample time, and intersample behavior for continuous models
For all these data types, the general data format requirements, as implemented in the three data types, are as follows:
For singleinput/singleoutput (SISO) data, the sampled data values must be double column vectors with lengths equal to the number of data samples (measurements).
For multiinput/multioutput (MIMO) data with N_{u} inputs and N_{y} outputs, and N_{s} number of data samples:
The input data must be an N_{s}byN_{u} matrix
The output data must be an N_{s}byN_{y} matrix
To use timedomain data for identification, you must know the sample time. If you are
working with uniformly sampled data, use the actual sample time from your experiment. Each
data value is assigned a time instant, which is calculated from the start time and sample
time. You can work with nonuniformly sampled data only at the command line by specifying a
vector of time instants using the SamplingInstants
property of iddata
, as described in Constructing an iddata Object for TimeDomain Data or by
using the time
variable in a timetable
. Typically,
estimation algorithms require uniformly sampled data.
If the data is contained in numeric matrices, the matrices provide no sampletime knowledge. The data must be uniformly sampled in this case. The software assumes the sample time is 1 second unless you specify a different sample time explicitly in the function syntax. Estimating continuous models using matrixbased data is not recommended.
For continuoustime models, you must also know the input intersample behavior, such as zeroorder hold and firstorderhold.
For more information about importing data into MATLAB^{®}, see Data Import and Export.
After you have the variables in the MATLAB workspace, import them into the System Identification app or create a data object for working at the command line. For more information, see Import TimeDomain Data into the App, Data Types in System Identification Toolbox, and Representing Time and FrequencyDomain Data Using iddata Objects.
TimeSeries Data Representation
Timeseries data is timedomain or frequencydomain data that consist of one or more outputs y(t) with no corresponding input. For more information on how to obtain identification data, see Ways to Obtain Identification Data.
You must organize timeseries data in the following format:
For singleinput/singleoutput (SISO) data, the output data values must be a column vector.
For data with N_{y} outputs, the output is an N_{s}byN_{y} matrix, where N_{s} is the number of output data samples (measurements).
To use timeseries data for identification, you also need the sample time. If you are
working with uniformly sampled data, use the actual sample time from your experiment. Each
data value is assigned a sample time, which is calculated from the start time and the sample
time. If you are working with nonuniformly sampled data at the command line, you can specify
a vector of time instants using the iddata
SamplingInstants
property, as described in Constructing an iddata Object for TimeDomain Data, or by
using the time
variable in a timetable
. Note that model
estimation cannot be performed using nonuniformly sampled data.
For more information about importing data into the MATLAB workspace, see Data Import and Export.
After you have the variables in the MATLAB workspace, import them into the System Identification app or create a data object for working at the command line. For more information, see Import TimeDomain Data into the App and Representing Time and FrequencyDomain Data Using iddata Objects.
For information about estimating timeseries model parameters, see Time Series Analysis.
FrequencyDomain Data Representation
Frequencydomain data consists of either transformed input and output timedomain signals or system frequency response sampled as a function of the independent variable frequency.
FrequencyDomain Input/Output Signal Representation
What Is FrequencyDomain Input/Output Signal?. Frequencydomain data is the Fourier transform of the input and output timedomain signals. For continuoustime signals, the Fourier transform over the entire time axis is defined as follows:
$$\begin{array}{l}Y(iw)={\displaystyle \underset{\infty}{\overset{\infty}{\int}}y(t){e}^{iwt}}dt\\ U(iw)={\displaystyle \underset{\infty}{\overset{\infty}{\int}}u(t){e}^{iwt}}dt\end{array}$$
In the context of numerical computations, continuous equations are replaced by their discretized equivalents to handle discrete data values. For a discretetime system with a sample time T, the frequencydomain output Y(e^{iw}) and input U(e^{iw}) is the timediscrete Fourier transform (TDFT):
$$Y({e}^{iwT})=T{\displaystyle \sum _{k=1}^{N}y(kT){e}^{iwkT}}$$
In this example, k = 1,2,...,N
, where N
is the
number of samples in the sequence.
Note
This form only discretizes the time. The frequency is continuous.
In practice, the Fourier transform cannot be handled for all continuous frequencies and you must specify a finite number of frequencies. The discrete Fourier transform (DFT) of timedomain data for N equally spaced frequencies between 0 and the sampling frequency 2π/N is:
$$\begin{array}{l}Y({e}^{i{w}_{n}T})={\displaystyle \sum _{k=1}^{N}y(kT){e}^{i{w}_{n}kT}}\\ {w}_{n}=\frac{2\pi n}{T}\text{}n=0,1,2,\dots ,N1\end{array}$$
The DFT is useful because it can be calculated very efficiently using the fast Fourier transform (FFT) method. Fourier transforms of the input and output data are complex numbers.
For more information on how to obtain identification data, see Ways to Obtain Identification Data.
How to Represent FrequencyDomain Data in MATLAB. You must organize frequencydomain data in the following format:
Input and output
For singleinput/singleoutput (SISO) data:
The input data must be a column vector containing the values $$u\left({e}^{i\omega kT}\right)$$
The output data must be a column vector containing the values $$y\left({e}^{i\omega kT}\right)$$
k=1, 2, ..., N_{f}, where N_{f} is the number of frequencies.
For multiinput/multioutput data with N_{u} inputs, N_{y } outputs and N_{f} frequency measurements:
The input data must be an N_{f}byN_{u} matrix
The output data must be an N_{f}byN_{y} matrix
Frequencies
Must be a column vector.
For more information about importing data into the MATLAB workspace, see Data Import and Export.
After you have the variables in the MATLAB workspace, import them into the System Identification app or create a data object for working at the command line. For more information, see Importing FrequencyDomain Input/Output Signals into the App and Representing Time and FrequencyDomain Data Using iddata Objects.
FrequencyResponse Data Representation
What Is FrequencyResponse Data?. Frequencyresponse data, also called frequencyfunction data, consists of complex frequencyresponse values for a linear system characterized by its transfer function G. Frequencyresponse data tells you how the system handles sinusoidal inputs. You can measure frequencyresponse data values directly using a spectrum analyzer, for example, which provides a compact representation of the inputoutput relationship (compared to storing input and output independently).
The transfer function G is an operator that takes the input u of a linear system to the output y:
$$y=Gu$$
For a continuoustime system, the transfer function relates the Laplace transforms of the input U(s) and output Y(s):
$$Y(s)=G(s)U(s)$$
In this case, the frequency function G(iw) is the transfer function evaluated on the imaginary axis s=iw.
For a discretetime system sampled with a time interval T, the transfer function relates the Ztransforms of the input U(z) and output Y(z):
$$Y(z)=G(z)U(z)$$
In this case, the frequency function G(e^{iwT}) is the transfer function G(z) evaluated on the unit circle. The argument of the frequency function G(e^{iwT}) is scaled by the sample time T to make the frequency function periodic with the sampling frequency $${\scriptscriptstyle \raisebox{1ex}{$2\pi $}\!\left/ \!\raisebox{1ex}{$T$}\right.}$$.
When the input to the system is a sinusoid of a specific frequency, the output is also a sinusoid with the same frequency. The amplitude of the output is $$\leftG\right$$ times the amplitude of the input. The phase of the shifted from the input by $$\phi =\mathrm{arg}G$$. G is evaluated at the frequency of the input sinusoid.
Frequencyresponse data represents a (nonparametric) model of the relationship between the input and the outputs as a function of frequency. You might use such a model, which consists of a table or plot of values, to study the system frequency response. However, this model is not suitable for simulation and prediction. You should create parametric model from the frequencyresponse data.
For more information on how to obtain identification data, see Ways to Obtain Identification Data.
How to Represent FrequencyResponse Data in MATLAB. You can represent frequencyresponse data in two ways:
Complexvalues G(e^{iω}) , for given frequencies ω
Amplitude $$\leftG\right$$ and phase shift $$\phi =\mathrm{arg}G$$ values
You can import both the formats directly in the System Identification app. At the
command line, you must represent complex data using an frd
or
idfrd
object. If the data is in amplitude
and phase format, convert it to complex frequencyresponse vector using h(ω) = A(ω)e^{jϕ(ω)}.
You must organize frequencyresponse data in the following format:
FrequencyResponse Data Representation  For SingleInput SingleOutput (SISO) Data  For MultiInput MultiOutput (MIMO) Data 

Complex Values 


Amplitude and phase shift values 


For more information about importing data into the MATLAB workspace, see Data Import and Export.
After you have the variables in the MATLAB workspace, import them into the System Identification app or create a data object for working at the command line. For more information about importing data into the app, see Importing FrequencyResponse Data into the App. To learn more about creating a data object, see Representing FrequencyResponse Data Using idfrd Objects.