Representing Data in MATLAB Workspace
Time-Domain Data Representation
Time-domain 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 Time-Series Data Representation.
You can organize time-domain 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 single-input/single-output (SISO) data, the sampled data values must be double column vectors with lengths equal to the number of data samples (measurements).
For multi-input/multi-output (MIMO) data with Nu inputs and Ny outputs, and Ns number of data samples:
The input data must be an Ns-by-Nu matrix
The output data must be an Ns-by-Ny matrix
To use time-domain 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 Time-Domain 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 sample-time 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 matrix-based data is not recommended.
For continuous-time models, you must also know the input intersample behavior, such as zero-order hold and first-order-hold.
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 Time-Domain Data into the App, Data Domains and Data Types in System Identification Toolbox, and Representing Time- and Frequency-Domain Data Using iddata Objects.
Time-Series Data Representation
Time-series data is time-domain or frequency-domain 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 time-series data in the following format:
For single-input/single-output (SISO) data, the output data values must be a column vector.
For data with Ny outputs, the output is an Ns-by-Ny matrix, where Ns is the number of output data samples (measurements).
To use time-series 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 Time-Domain Data, or by
using the time
variable in a timetable
. Note that model
estimation cannot be performed using non-uniformly 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 Time-Domain Data into the App and Representing Time- and Frequency-Domain Data Using iddata Objects.
For information about estimating time-series model parameters, see Time Series Analysis.
Frequency-Domain Data Representation
Frequency-domain data consists of either transformed input and output time-domain signals or system frequency response sampled as a function of the independent variable frequency.
Frequency-Domain Input/Output Signal Representation
What Is Frequency-Domain Input/Output Signal?. Frequency-domain data is the Fourier transform of the input and output time-domain signals. For continuous-time signals, the Fourier transform over the entire time axis is defined as follows:
In the context of numerical computations, continuous equations are replaced by their discretized equivalents to handle discrete data values. For a discrete-time system with a sample time T, the frequency-domain output Y(eiw) and input U(eiw) is the time-discrete Fourier transform (TDFT):
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 time-domain data for N equally spaced frequencies between 0 and the sampling frequency 2π/N is:
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 Frequency-Domain Data in MATLAB. You must organize frequency-domain data in the following format:
Input and output
For single-input/single-output (SISO) data:
The input data must be a column vector containing the values
The output data must be a column vector containing the values
k=1, 2, ..., Nf, where Nf is the number of frequencies.
For multi-input/multi-output data with Nu inputs, Ny outputs and Nf frequency measurements:
The input data must be an Nf-by-Nu matrix
The output data must be an Nf-by-Ny 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 Frequency-Domain Input/Output Signals into the App and Representing Time- and Frequency-Domain Data Using iddata Objects.
Frequency-Response Data Representation
What Is Frequency-Response Data?. Frequency-response data, also called frequency-function data, consists of complex frequency-response values for a linear system characterized by its transfer function G. Frequency-response data tells you how the system handles sinusoidal inputs. You can measure frequency-response data values directly using a spectrum analyzer, for example, which provides a compact representation of the input-output 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:
For a continuous-time system, the transfer function relates the Laplace transforms of the input U(s) and output Y(s):
In this case, the frequency function G(iw) is the transfer function evaluated on the imaginary axis s=iw.
For a discrete-time system sampled with a time interval T, the transfer function relates the Z-transforms of the input U(z) and output Y(z):
In this case, the frequency function G(eiwT) is the transfer function G(z) evaluated on the unit circle. The argument of the frequency function G(eiwT) is scaled by the sample time T to make the frequency function periodic with the sampling frequency .
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 times the amplitude of the input. The phase of the shifted from the input by . G is evaluated at the frequency of the input sinusoid.
Frequency-response 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 frequency-response data.
For more information on how to obtain identification data, see Ways to Obtain Identification Data.
How to Represent Frequency-Response Data in MATLAB. You can represent frequency-response data in two ways:
Complex-values G(eiω) , for given frequencies ω
Amplitude and phase shift 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 frequency-response vector using h(ω) = A(ω)ejϕ(ω).
You must organize frequency-response data in the following format:
Frequency-Response Data Representation | For Single-Input Single-Output (SISO) Data | For Multi-Input Multi-Output (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 Frequency-Response Data into the App. To learn more about creating a data object, see Representing Frequency-Response Data Using idfrd Objects.