Main Content

sigma

Singular values of frequency response of dynamic system

    Description

    [sv,wout] = sigma(sys) returns the singular values sv of the frequency response of dynamic system model sys at each frequency in the vector wout. The function automatically determines frequencies to plot based on system dynamics.

    example

    [sv,wout] = sigma(sys,w) returns singular values at the frequencies specified by w. You can specify a frequency range or a vector of frequencies.

    example

    sv = sigma(sys,w,type) returns modified singular values of the specified type. You can use this syntax only for systems that have the same number of inputs and outputs.

    sigma(___) plots the singular values of the frequency response of sys with default plotting options for all of the previous input argument combinations. If sys is a single-input, single-output (SISO) model, then the singular value plot is similar to its Bode magnitude response. For more plot customization options, use sigmaplot.

    • To plot singular values for multiple dynamic systems on the same plot, you can specify sys as a comma-separated list of models. For example, sigma(sys1,sys2,sys3) plots the singular values for three models on the same plot.

    • To specify a color, line style, and marker for each system in the plot, specify a LineSpec value for each system. For example, sigma(sys1,LineSpec1,sys2,LineSpec2) plots two models and specifies their plot style. For more information on specifying a LineSpec value, see sigmaplot.

    Examples

    collapse all

    Create a singular value plot of the following continuous-time SISO dynamic system.

    H(s)=s2+0.1s+7.5s4+0.12s3+9s2

    H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
    sigma(H)

    MATLAB figure

    sigma automatically selects the plot range based on the system dynamics.

    Create a singular value plot over a specified frequency range. Use this approach when you want to focus on the dynamics in a particular range of frequencies.

    H = tf([-0.1,-2.4,-181,-1950],[1,3.3,990,2600]);
    sigma(H,{1,100})
    grid on

    The cell array {1,100} specifies the minimum and maximum frequency values in the plot. When you provide frequency bounds in this way, the function selects intermediate points for frequency response data.

    Alternatively, specify a vector of frequency points to use for evaluating and plotting the frequency response.

    w = [1 5 10 15 20 23 31 40 44 50 85 100];
    sigma(H,w,'.-')
    grid on

    MATLAB figure

    sigma plots the frequency response at the specified frequencies only.

    Compare the frequency response of a continuous-time system to an equivalent discretized system on the same singular value plot.

    Create continuous-time and discrete-time dynamic systems.

    H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
    Hd = c2d(H,0.5,'zoh');

    Create a plot that displays both systems.

    sigma(H,Hd)
    legend("Continuous","Discrete")

    MATLAB figure

    ans = 
      Legend (Continuous, Discrete) with properties:
    
             String: {'Continuous'  'Discrete'}
           Location: 'northeast'
        Orientation: 'vertical'
           FontSize: 9
           Position: [0.6738 0.7968 0.2121 0.0789]
              Units: 'normalized'
    
      Use GET to show all properties
    
    

    The sigma plot of a discrete-time system includes a vertical line marking the Nyquist frequency of the system.

    Specify the line style, color, or marker for each system in a sigma plot using the LineSpec input argument.

    H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
    Hd = c2d(H,0.5,'zoh');
    sigma(H,'r',Hd,'b--')

    MATLAB figure

    The first LineSpec, 'r', specifies a solid red line for the response of H. The second LineSpec, 'b--', specifies a dashed blue line for the response of Hd.

    Compute the singular values of the frequency response of a SISO system.

    If you do not specify frequencies, sigma chooses frequencies based on the system dynamics and returns them in the second output argument.

    H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
    [sv,wout] = sigma(H);

    Because H is a SISO model, the first dimension of sv is 1. The second dimension is the number of frequencies in wout.

    size(sv)
    ans = 1×2
    
         1    40
    
    
    length(wout)
    ans = 
    40
    

    Thus, each entry along the second dimension of sv gives the singular value of the response at the corresponding frequency in wout.

    For this example, create a 2-output, 3-input system.

    rng(0,'twister'); % For reproducibility
    H = rss(4,2,3);

    For this system, sigma plots the singular values of the frequency response matrix in the same plot.

    sigma(H)

    MATLAB figure

    Compute the singular values at 20 frequencies between 1 and 10 radians.

    w = logspace(0,1,20);
    sv = sigma(H,w);

    sv is a matrix, in which the rows correspond to the singular values of the frequency response matrix and the columns are the frequency values. Examine the dimensions.

    size(sv)
    ans = 1×2
    
         2    20
    
    

    Thus, for example, sv(:,10) are the singular values of the response computed at the 10th frequency in w.

    Consider the following two-input, two-output dynamic system.

    H(s)=[03ss2+s+10s+1s+52s+6].

    Compute the singular value responses of H(s) and I + H(s).

    H = [0, tf([3 0],[1 1 10]) ; tf([1 1],[1 5]), tf(2,[1 6])];
    [svH,wH] = sigma(H);
    [svIH,wIH] = sigma(H,[],2);

    In the last command, the input 2 selects the second response type, I + H(s). The vectors svH and svIH contain the singular value response data, at the frequencies in wH and wIH.

    Plot the singular value responses of both systems.

    subplot(211)
    sigma(H)
    subplot(212)
    sigma(H,[],2)

    MATLAB figure

    Create a singular value plot of a model with complex coefficients and a model with real coefficients on the same plot.

    rng(0)
    A = [-3.50,-1.25-0.25i;2,0];
    B = [1;0];
    C = [-0.75-0.5i,0.625-0.125i];
    D = 0.5;
    Gc = ss(A,B,C,D);
    Gr = rss(4);
    sigma(Gc,Gr)
    legend('Complex-coefficient model','Real-coefficient model');

    In log frequency scale, the plot shows two branches for models with complex coefficients, one for positive frequencies, with a right-pointing arrow, and one for negative frequencies, with a left-pointing arrow. In both branches, the arrows indicate the direction of increasing frequencies. The plots for models with real coefficients always contain a single branch with no arrows.

    You can change the frequency scale of the plot by right-clicking the plot and selecting Properties. In the Property Editor dialog, on the Units tab, set the frequency scale to linear scale. Alternatively, you can use the sigmaplot function and modify the chart object properties.

    Create the plot with customized options.

    sp = sigmaplot(Gc,Gr);
    sp.FrequencyScale = 'linear'
    sp = 
      SigmaPlot with properties:
    
              Responses: [2x1 controllib.chart.response.SigmaResponse]
        Characteristics: [1x1 controllib.chart.options.CharacteristicsManager]
    
          FrequencyUnit: "rad/s"
         FrequencyScale: "linear"
          MagnitudeUnit: "dB"
         MagnitudeScale: "linear"
    
            GridVisible: off
                Visible: on
    
      Use GET to show all properties
    
    
    legend('Complex-coefficient model','Real-coefficient model');

    MATLAB figure

    In linear frequency scale, the plot shows a single branch with a symmetric frequency range centered at a frequency value of zero. The plot also shows the negative-frequency response of a model with real coefficients when you plot the response along with a model with complex coefficients.

    Input Arguments

    collapse all

    Dynamic system, specified as a SISO or MIMO dynamic system model or array of dynamic system models. Dynamic systems that you can use include:

    • Continuous-time or discrete-time numeric LTI models, such as tf, zpk, or ss models.

    • Sparse state-space models, such as sparss or mechss models. Frequency grid w must be specified for sparse models.

    • Generalized or uncertain LTI models such as genss or uss (Robust Control Toolbox) models. Using uncertain models requires Robust Control Toolbox™ software.

      • For tunable control design blocks, the function evaluates the model at its current value to plot the response.

      • For uncertain control design blocks, the function plots the nominal value and random samples of the model.

    • Frequency-response data models such as frd models. For such models, the function plots the response at the frequencies defined in the model.

    • Identified LTI models, such as idtf (System Identification Toolbox), idss (System Identification Toolbox), or idproc (System Identification Toolbox) models. Using identified models requires System Identification Toolbox™ software.

    If sys is an array of models, the plot shows responses of all models in the array on the same axes.

    Frequencies at which to compute the response, specified as one of the following:

    • Cell array of the form {wmin,wmax} — Compute the response at frequencies in the range from wmin to wmax. If wmax is greater than the Nyquist frequency of sys, the response is computed only up to the Nyquist frequency.

    • Vector of frequencies — Compute the response at each specified frequency. For example, use logspace to generate a row vector with logarithmically spaced frequency values. The vector w can contain both positive and negative frequencies.

    • [] — Automatically select frequencies based on system dynamics.

    For models with complex coefficients, if you specify a frequency range of [wmin,wmax] for your plot, then in:

    • Log frequency scale, the plot frequency limits are set to [wmin,wmax] and the plot shows two branches, one for positive frequencies [wmin,wmax] and one for negative frequencies [–wmax,–wmin].

    • Linear frequency scale, the plot frequency limits are set to [–wmax,wmax] and the plot shows a single branch with a symmetric frequency range centered at a frequency value of zero.

    Specify frequencies in units of rad/TimeUnit, where TimeUnit is the TimeUnit property of the model.

    Type of modified singular values to plot, specified as one of the following values.

    • 1 — Plot the singular values of the frequency response H-1, where H is the frequency response of sys.

    • 2 — Plot the singular values of the frequency response I+H.

    • 3 — Plot the singular values of the frequency response I+H-1.

    Dependencies

    You can specify type only when sys has the same number of inputs and outputs.

    Output Arguments

    collapse all

    Singular values of the frequency response in absolute units, returned as a matrix. sv contains the singular values computed at the frequencies w if you supplied them, or wout if you did not. For a system sys with Nu inputs and Ny outputs, sv has min(Nu,Ny) rows, and as many columns as there are values in w or wout. The value sv(:,k) gives the singular values in descending order at the frequency wout(k).

    Frequencies at which the function returns the system response, returned as a column vector. The function chooses the frequency values based on the model dynamics, unless you specify frequencies using the input argument w.

    wout also contains negative frequency values for models with complex coefficients.

    Frequency values are in radians per TimeUnit, where TimeUnit is the value of the TimeUnit property of sys.

    Algorithms

    sigma uses the MATLAB® function svd to compute the singular values of the complex frequency response.

    • For an frd model, sigma computes the singular values of sys.ResponseData at the frequencies, sys.Frequency.

    • For continuous-time tf, ss, or zpk models with transfer function H(s), sigma computes the singular values of H(jω) as a function of the frequency ω.

    • For discrete-time tf, ss, or zpk models with transfer function H(z) and sample time Ts, sigma computes the singular values of

      H(ejωTs)

      for frequencies ω between 0 and the Nyquist frequency ωN = π/Ts.

    Version History

    Introduced before R2006a