Main Content

genfrd

Generalized frequency response data (FRD) model

Description

Use a generalized FRD (genfrd) model to represent a system having both tunable control design blocks and a fixed numerical component expressed as frequency-response data. genfrd models keep track of how the tunable blocks interact with the fixed frequency-response component. For more information about generalized models with tunable components, see Generalized Models.

Creation

To construct a genfrd model:

Description

fsys = genfrd(sys,frequency) converts a static model or dynamic system model to a generalized FRD model and sets the value of the Frequency property of fsys. If sys is not an frd model object, genfrd computes the frequency response at each point in frequency. If sys is an frd model, frequency must match the values in sys.Frequency.

example

frdsys = genfrd(sys,frequency,frequencyunit) further specifies the units of Frequency and sets the FrequencyUnit property of fsys.

frdsys = genfrd(sys,frequency,frequencyunit,timeunit) further specifies the TimeUnit property of fsys. This syntax is useful when you convert a static model to genfrd form because the static model has no associated time unit.

Input Arguments

expand all

Model to convert to genfrd, specified as a dynamic system model or a static model. For instance, sys can be a:

  • Numeric LTI model, such as a tf, zpk, or ss model.

  • Frequency response data model, such as an frd model. If sys is an frd model, frequency must match the values in sys.Frequency. To convert an frd model to genfrd form with a different frequency vector, first use interp to resample the frd model.

  • Generalized LTI model, such as a genss model.

  • Static model, such as a generalized static matrix, genmat.

The resulting genfrd model has the same control design blocks as sys. If sys is a numeric LTI model or other model with no control design blocks, then the resulting genfrd model has zero control design blocks.

Properties

expand all

Control design blocks included in the generalized LTI model or generalized matrix, specified as a structure. The field names of Blocks are the Name property of each control design block.

You can change some attributes of these control design blocks using dot notation. For example, if the generalized LTI model or generalized matrix M contains a realp tunable parameter a, change the current value of a.

M.Blocks.a.Value = -1;

Frequency values at which the system response is sampled, specified as a vector of values with units given by FrequencyUnit.

Units of the frequency vector in the Frequency property, specified as one of the following values:

  • 'rad/TimeUnit'

  • 'cycles/TimeUnit'

  • 'rad/s'

  • 'Hz'

  • 'kHz'

  • 'MHz'

  • 'GHz'

  • 'rpm'

The units 'rad/TimeUnit' and 'cycles/TimeUnit' are relative to the time units specified in the TimeUnit property.

Changing this property does not resample or convert the data. Modifying the property changes only the interpretation of the existing data. Use chgFreqUnit to convert the data to different frequency units.

Input delay for each input channel, specified as one of the following:

  • Scalar — Specify the input delay for a SISO system or the same delay for all inputs of a multi-input system.

  • Nu-by-1 vector — Specify separate input delays for input of a multi-input system, where Nu is the number of inputs.

For continuous-time systems, specify input delays in the time unit specified by the TimeUnit property. For discrete-time systems, specify input delays in integer multiples of the sample time, Ts.

For more information, see Time Delays in Linear Systems.

Output delay for each output channel, specified as one of the following:

  • Scalar — Specify the output delay for a SISO system or the same delay for all outputs of a multi-output system.

  • Ny-by-1 vector — Specify separate output delays for output of a multi-output system, where Ny is the number of outputs.

For continuous-time systems, specify output delays in the time unit specified by the TimeUnit property. For discrete-time systems, specify output delays in integer multiples of the sample time, Ts.

For more information, see Time Delays in Linear Systems.

Input channel names, specified as one of the following:

  • A character vector, for single-input models.

  • A cell array of character vectors, for multi-input models.

  • '', no names specified, for any input channels.

Alternatively, you can assign input names for multi-input models using automatic vector expansion. For example, if sys is a two-input model, enter the following.

sys.InputName = 'controls';

The input names automatically expand to {'controls(1)';'controls(2)'}.

You can use the shorthand notation u to refer to the InputName property. For example, sys.u is equivalent to sys.InputName.

Use InputName to:

  • Identify channels on model display and plots.

  • Extract subsystems of MIMO systems.

  • Specify connection points when interconnecting models.

Input channel units, specified as one of the following:

  • A character vector, for single-input models.

  • A cell array of character vectors, for multi-input models.

  • '', no units specified, for any input channels.

Use InputUnit to specify input signal units. InputUnit has no effect on system behavior.

Input channel groups, specified as a structure. Use InputGroup to assign the input channels of MIMO systems into groups and refer to each group by name. The field names of InputGroup are the group names and the field values are the input channels of each group. For example, enter the following to create input groups named controls and noise that include input channels 1 and 2, and 3 and 5, respectively.

sys.InputGroup.controls = [1 2];
sys.InputGroup.noise = [3 5];

You can then extract the subsystem from the controls inputs to all outputs using the following.

sys(:,'controls')

By default, InputGroup is a structure with no fields.

Output channel names, specified as one of the following:

  • A character vector, for single-output models.

  • A cell array of character vectors, for multi-output models.

  • '', no names specified, for any output channels.

Alternatively, you can assign output names for multi-output models using automatic vector expansion. For example, if sys is a two-output model, enter the following.

sys.OutputName = 'measurements';

The output names automatically expand to {'measurements(1)';'measurements(2)'}.

You can also use the shorthand notation y to refer to the OutputName property. For example, sys.y is equivalent to sys.OutputName.

Use OutputName to:

  • Identify channels on model display and plots.

  • Extract subsystems of MIMO systems.

  • Specify connection points when interconnecting models.

Output channel units, specified as one of the following:

  • A character vector, for single-output models.

  • A cell array of character vectors, for multi-output models.

  • '', no units specified, for any output channels.

Use OutputUnit to specify output signal units. OutputUnit has no effect on system behavior.

Output channel groups, specified as a structure. Use OutputGroup to assign the output channels of MIMO systems into groups and refer to each group by name. The field names of OutputGroup are the group names and the field values are the output channels of each group. For example, create output groups named temperature and measurement that include output channels 1, and 3 and 5, respectively.

sys.OutputGroup.temperature = [1];
sys.OutputGroup.measurement = [3 5];

You can then extract the subsystem from all inputs to the measurement outputs using the following.

sys('measurement',:)

By default, OutputGroup is a structure with no fields.

User-specified text that you want to associate with the system, specified as a character vector or cell array of character vectors. For example, 'System is MIMO'.

User-specified data that you want to associate with the system, specified as any MATLAB data type.

System name, specified as a character vector. For example, 'system_1'.

Sample time, specified as:

  • 0 for continuous-time systems.

  • A positive scalar representing the sampling period of a discrete-time system. Specify Ts in the time unit specified by the TimeUnit property.

  • -1 for a discrete-time system with an unspecified sample time.

Note

Changing Ts does not discretize or resample the model.

Time variable units, specified as one of the following:

  • 'nanoseconds'

  • 'microseconds'

  • 'milliseconds'

  • 'seconds'

  • 'minutes'

  • 'hours'

  • 'days'

  • 'weeks'

  • 'months'

  • 'years'

Changing TimeUnit has no effect on other properties, but changes the overall system behavior. Use chgTimeUnit to convert between time units without modifying system behavior.

Sampling grid for model arrays, specified as a structure array.

Use SamplingGrid to track the variable values associated with each model in a model array, including identified linear time-invariant (IDLTI) model arrays.

Set the field names of the 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 must be numeric scalars, and all arrays of sampled values must match the dimensions of the model array.

For example, you can create an 11-by-1 array of linear models, sysarr, by taking snapshots of a linear time-varying system at times t = 0:10. The following code stores the time samples with the linear models.

 sysarr.SamplingGrid = struct('time',0:10)

Similarly, you can create a 6-by-9 model array, M, by independently sampling two variables, zeta and w. The following code maps the (zeta,w) values to M.

[zeta,w] = ndgrid(<6 values of zeta>,<9 values of w>)
M.SamplingGrid = struct('zeta',zeta,'w',w)

When you display M, each entry in the array includes the corresponding zeta and w values.

M
M(:,:,1,1) [zeta=0.3, w=5] =
 
        25
  --------------
  s^2 + 3 s + 25
 

M(:,:,2,1) [zeta=0.35, w=5] =
 
         25
  ----------------
  s^2 + 3.5 s + 25
 
...

For model arrays generated by linearizing a Simulink® model at multiple parameter values or operating points, the software populates SamplingGrid automatically with the variable values that correspond to each entry in the array. For instance, the Simulink Control Design™ commands linearize (Simulink Control Design) and slLinearizer (Simulink Control Design) populate SamplingGrid automatically.

By default, SamplingGrid is a structure with no fields.

Object Functions

The following lists contain a representative subset of the functions you can use with genfrd models. In general, many functions applicable to generalized state-space (genss) models are also applicable to genfrd models. genfrd models do not work with any time-domain analysis functions.

expand all

getIOTransferClosed-loop transfer function from generalized model of control system
getLoopTransferOpen-loop transfer function of control system represented by genss model
getSensitivitySensitivity function from generalized model of control system
getCompSensitivityComplementary sensitivity function from generalized model of control system
getValueCurrent value of generalized model
getBlockValueGet current value of Control Design Block in Generalized Model
setBlockValueModify value of Control Design Block in Generalized Model
bodeBode frequency response of dynamic system
sigmaSingular values of frequency response of dynamic system
nyquistNyquist response of dynamic system
nicholsNichols response of dynamic system
bandwidthFrequency response bandwidth
freqrespEvaluate system response over a grid of frequencies
marginGain margin, phase margin, and crossover frequencies
feedbackFeedback connection of multiple models
connectBlock diagram interconnections of dynamic systems
seriesSeries connection of two models
parallelParallel connection of two models
systuneTune fixed-structure control systems modeled in MATLAB

Examples

collapse all

Create a genfrd model by connecting a fixed-value frd model with a tunable control design block.

Load frequency-response data. The file wtankData.mat contains a vector of frequencies, frequency, and the corresponding responses of a system, response. In practice, you might obtain such frequency-response data by simulation, frequency-response estimation, or measurement. Use the data to create a numeric frd model.

load wtankData.mat
fsys = frd(response,frequency);
size(fsys)
FRD model with 1 outputs, 1 inputs, and 20 frequency points.

Create a tunable PI controller, represented by a tunablePID control design block.

C = tunablePID('C','PI');

Connect the numeric frd model with the tunable PI controller to create a generalized frd model containing one control design block, C.

gsys = feedback(fsys*C,1)
Generalized continuous-time FRD model with 1 outputs, 1 inputs, 20 frequency points, and the following blocks:
  C: Tunable PID controller, 1 occurrences.

Type "frd(gsys)" to see the current value and "gsys.Blocks" to interact with the blocks.

Create a generalized state-space model of a second-order system in which the natural frequency and damping coefficients are tunable parameters.

wn = realp('wn',3);
zeta = realp('zeta',0.8);
sys = tf(1,[(1/wn)^2 2*zeta*(1/wn) 1])
Generalized continuous-time state-space model with 1 outputs, 1 inputs, 2 states, and the following blocks:
  wn: Scalar parameter, 3 occurrences.
  zeta: Scalar parameter, 1 occurrences.

Type "ss(sys)" to see the current value and "sys.Blocks" to interact with the blocks.

Sample sys at frequencies of interest using the genfrd command. The result is a genfrd model with the same tunable parameters as sys.

frequency = logspace(-1,2,20);
fsys = genfrd(sys,frequency)
Generalized continuous-time FRD model with 1 outputs, 1 inputs, 20 frequency points, and the following blocks:
  wn: Scalar parameter, 3 occurrences.
  zeta: Scalar parameter, 1 occurrences.

Type "frd(fsys)" to see the current value and "fsys.Blocks" to interact with the blocks.

To confirm the correspondence of the genfrd model fsys and the genss model sys, plot the responses of both models with their tunable parameters set to their current values.

bode(sys,"-",fsys,"g*")
legend

MATLAB figure

ans = 
  Legend (sys, fsys) with properties:

         String: {'sys'  'fsys'}
       Location: 'northeast'
    Orientation: 'vertical'
       FontSize: 8.1000
       Position: [0.8116 0.8583 0.1429 0.0884]
          Units: 'normalized'

  Use GET to show all properties

Create a numeric transfer function model and convert it to genfrd form. To do so, use the genfrd command, providing a vector of frequencies at which to sample the response.

sys = tf(1,[1 1]);
frequency = logspace(-1,2,20);
fsys = genfrd(sys,frequency)
Generalized continuous-time FRD model with 1 outputs, 1 inputs, 20 frequency points, and no blocks.

Type "frd(fsys)" to see the current value and "fsys.Blocks" to interact with the blocks.

The resulting model is a genfrd model. However, fsys contains no control design blocks.

fblocks = fsys.Blocks
fblocks = struct with no fields.


Version History

Introduced in R2011a