Frequencyresponse data or model
h = idfrd(Response,Freq,Ts)
h = idfrd(Response,Freq,Ts,'CovarianceData',Covariance,'SpectrumData',Spec,'NoiseCovariance',Speccov)
h = idfrd(Response,Freq,Ts,...
'P1',V1,'PN',VN)
h = idfrd(mod)
h = idfrd(mod,Freqs)
h = idfrd(Response,Freq,Ts)
constructs
an idfrd
object that stores the frequency response Response
of
a linear system at frequency values Freq
. Ts
is
the sample time. For a continuoustime system, set Ts=0
.
h = idfrd(Response,Freq,Ts,'CovarianceData',Covariance,'SpectrumData',Spec,'NoiseCovariance',Speccov)
also
stores the uncertainty of the response Covariance
,
the spectrum of the additive disturbance (noise) Spec
,
and the covariance of the noise Speccov
.
h = idfrd(Response,Freq,Ts,...
constructs an
'P1',V1,'PN',VN)idfrd
object
that stores a frequencyresponse model with properties specified by
the idfrd
model propertyvalue pairs.
h = idfrd(mod)
converts a System Identification Toolbox™ or Control System Toolbox™ linear
model to frequencyresponse data at default frequencies, including
the output noise spectra and their covariance.
h = idfrd(mod,Freqs)
converts a System Identification Toolbox or Control System Toolbox linear
model to frequencyresponse data at frequencies Freqs
.
For a model
$$y(t)=G(q)u(t)+H(q)e(t)$$
stores the transfer function estimate $$G\left({e}^{i\omega}\right)$$, as well as the spectrum of the additive noise (Φ_{v}) at the output
$${\Phi}_{v}(\omega )=\lambda T{H(e{}^{i\omega T})}^{2}$$
where λ is the estimated variance of e(t), and T is the sample time.
Response
is a 3D array of dimension ny
bynu
byNf
,
with ny
being the number of outputs, nu
the
number of inputs, and Nf
the number of frequencies
(that is, the length of Freqs
). Response(ky,ku,kf)
is
thus the complexvalued frequency response from input ku
to
output ky
at frequency $$\omega $$=Freqs(kf)
.
When defining the response of a SISO system, Response
can
be given as a vector.
Freqs
is a column vector of length Nf
containing
the frequencies of the response.
Ts
is the sample time. Ts = 0
means
a continuoustime model.
Intersample behavior: For discretetime frequency response data
(Ts>0
), you can also specify the intersample
behavior of the input signal that was in effect when the samples were
collected originally from an experiment. To specify the intersample
behavior, use:
mf = idfrd(Response,Freq,Ts,'InterSample','zoh');
For multiinput systems, specify the intersample behavior using
an Nuby1 cell array, where Nu is
the number of inputs. The InterSample
property
is irrelevant for continuoustime data.
Covariance
is a 5D array containing the
covariance of the frequency response. It has dimension ny
bynu
byNf
by2by2.
The structure is such that Covariance(ky,ku,kf,:,:)
is
the 2by2 covariance matrix of the response Response(ky,ku,kf)
.
The 11 element is the variance of the real part, the 22 element
is the variance of the imaginary part, and the 12 and 21 elements
are the covariance between the real and imaginary parts. squeeze(Covariance(ky,ku,kf,:,:))
thus
gives the covariance matrix of the corresponding response.
The format for spectrum information is as follows:
spec
is a 3D array of dimension ny
byny
byNf
,
such that spec(ky1,ky2,kf)
is the cross spectrum
between the noise at output ky1
and the noise at
output ky2
, at frequency Freqs(kf)
.
When ky1 = ky2
the (power) spectrum of the noise
at output ky1
is thus obtained. For a singleoutput
model, spec
can be given as a vector.
speccov
is a 3D array of dimension ny
byny
byNf
,
such that speccov(ky1,ky1,kf)
is the variance of
the corresponding power spectrum.
If only SpectrumData
is to be packaged in
the idfrd
object, set Response = []
.
An idfrd
object can also be computed from
a given linear identified model, mod
.
If the frequencies Freqs
are not specified,
a default choice is made based on the dynamics of the model mod
.
Estimated covariance:
If you obtain mod
by identification,
the software computes the estimated covariance for the idfrd
object
from the uncertainty information in mod
. The software
uses the Gauss approximation formula for this calculation for all
model types, except greybox models. For greybox models (idgrey
),
the software applies numerical differentiation. The step sizes for
the numerical derivatives are determined by nuderst
.
If you create mod
by using commands
such as idss
, idtf
, idproc
, idgrey
,
or idpoly
, then the software sets CovarianceData
to []
.
Delay treatment: If mod
contains delays,
then the software assigns the delays of the idfrd
object, h
,
as follows:
h.InputDelay = mod.InputDelay
h.ioDelay = mod.ioDelay+repmat(mod.OutputDelay,[1,nu])
The expression repmat(mod.OutputDelay,[1,nu])
returns
a matrix containing the output delay for each input/output pair.
Frequency responses for submodels can be obtained by the standard
subreferencing, h = idfrd(m(2,3))
. h =
idfrd(m(:,[]))
gives an h
that just contains SpectrumData
.
The idfrd
models can be graphed with bode
, spectrum
,
and nyquist
, which accept mixtures of parametric
models, such as idtf
and idfrd
models
as arguments. Note that spa
, spafdr
,
and etfe
return their estimation results as idfrd
objects.
The idfrd
represents
complex frequencyresponse data. Before you can create an idfrd
object,
you must import your data as described in FrequencyResponse Data Representation.
Note:
The 
Use the following syntax to create the data
object fr_data
:
fr_data = idfrd(response,f,Ts)
Suppose that ny
is the number of output channels, nu
is
the number of input channels, and nf
is a vector
of frequency values. response
is an ny
bynu
bynf
3D
array. f
is the frequency vector that contains
the frequencies of the response.Ts
is the sample
time, which is used when measuring or computing the frequency response.
If you are working with a continuoustime system, set Ts
to 0
.
response(ky,ku,kf)
, where ky
, ku
,
and kf
reference the k
th output,
input, and frequency value, respectively, is interpreted as the complexvalued
frequency response from input ku
to output ky
at
frequency f(kf)
.
You can specify object properties when you create the idfrd
object
using the constructor syntax:
fr_data = idfrd(response,f,Ts, 'Property1',Value1,...,'PropertyN',ValueN)
idfrd
object properties include:

Frequency response data. The 

Frequency points of the frequency response data. Specify 

Frequency units of the model.
The units Changing this property changes the overall system behavior.
Use Default: 

Power spectra and cross spectra of the system output disturbances
(noise). Specify Specify For a singleoutput model, specify 

Response data covariance matrices. Specify


Power spectra variance. Specify 

Information about the estimation process.


Input intersample behavior. Specifies the behavior of the input signals between samples
for transformations between discretetime and continuoustime. This
property is meaningful for discretetime Set
For multiinput data, specify 

Transport delays. For continuoustime systems, specify transport delays in the
time unit stored in the For a MIMO system with Default: 

Input delay for each input channel, specified as a scalar value
or numeric vector. For continuoustime systems, specify input delays
in the time unit stored in the For a system with You can also set Default: 0 

Output delays. For identified systems, like 

Sample time. For continuoustime models, Changing this property does not discretize or resample the model.
Use Default: 

String representing the unit of the time variable. This property
specifies the units for the time variable, the sample time
Changing this property has no effect on other properties, and
therefore changes the overall system behavior. Use Default: 

Input channel names. Set Alternatively, use automatic vector expansion to assign input
names for multiinput models. For example, if sys.InputName = 'controls'; The input names automatically expand to When you estimate a model using an You can use the shorthand notation Input channel names have several uses, including:
Default: Empty string 

Input channel units. Use Default: Empty string 

Input channel groups. The sys.InputGroup.controls = [1 2]; sys.InputGroup.noise = [3 5]; creates input groups named sys(:,'controls') Default: Struct with no fields 

Output channel names. Set Alternatively, use automatic vector expansion to assign output
names for multioutput models. For example, if sys.OutputName = 'measurements'; The output names automatically expand to When you estimate a model using an You can use the shorthand notation Output channel names have several uses, including:
Default: Empty string 

Output channel units. Use Default: Empty string 

Output channel groups. The sys.OutputGroup.temperature = [1]; sys.InputGroup.measurement = [3 5]; creates output groups named sys('measurement',:) Default: Struct with no fields 

System name. Set Default: 

Any text that you want to associate with the system. Set Default: 

Any type of data you wish to associate with system. Set Default: 

Sampling grid for model arrays, specified as a data structure. For arrays of identified linear (IDLTI) models that are derived by sampling one or more independent variables, this property tracks the variable values associated with each model. This information appears when you display or plot the model array. Use this information to trace results back to the independent variables. Set the field names of the data structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables should be numeric and scalar valued, and all arrays of sampled values should match the dimensions of the model array. For example, if you collect data at various operating points of a system, you can identify a model for each operating point separately and then stack the results together into a single system array. You can tag the individual models in the array with information regarding the operating point: nominal_engine_rpm = [1000 5000 10000];
sys.SamplingGrid = struct('rpm', nominal_engine_rpm) where For model arrays generated by linearizing a Simulink^{®} model
at multiple parameter values or operating points, the software populates Default: 
To view the properties of the idfrd
object,
you can use the get
command.
The following example shows how to create an idfrd
object
that contains 100 frequencyresponse values with a sample time of
0.08 s and get its properties:
% Create the idfrd data object fr_data = idfrd(response,f,0.08) % Get property values of data get(fr_data)
response
and f
are variables
in the MATLAB Workspace browser, representing the frequencyresponse
data and frequency values, respectively.
To change property values for an existing idfrd
object,
use the set
command or dot notation.
For example, to change the name of the idfrd
object,
type the following command sequence at the prompt:
% Set the name of the f_data object set(fr_data,'name','DC_Converter') % Get fr_data properties and values get(fr_data)
If you import fr_data
into the System Identification
app, this data has the name DC_Converter
in the
app, and not the variable name fr_data
.
The different channels of the idfrd
are retrieved
by subreferencing.
h(outputs,inputs)
h(2,3)
thus contains the response data from
input channel 3 to output channel 2, and, if applicable, the output
spectrum data for output channel 2. The channels can also be referred
to by their names, as in h('power',{'voltage', 'speed'})
.
Adding input channels,
h = [h1,h2,...,hN]
creates an idfrd
model h
,
with ResponseData
containing all the input channels
in h1,...,hN
. The output channels of hk
must
be the same, as well as the frequency vectors. SpectrumData
is
ignored.
Adding output channels,
h = [h1;h2;... ;hN]
creates an idfrd
model h
with ResponseData
containing
all the output channels in h1, h2,...,hN
. The input
channels of hk
must all be the same, as well as
the frequency vectors. SpectrumData
is also appended
for the new outputs. The cross spectrum between output channels of h1,
h2,...,hN
is then set to zero.
You can convert an idfrd
object to a frequencydomain iddata
object
by
Data = iddata(Idfrdmodel)
See iddata
.
Compare the results from spectral analysis and an ARMAX model.
load iddata1 z1; m = armax(z1,[2 2 2 1]); g = spa(z1) g = spafdr(z1,[],{1e3,10}) bode(g,m)