Documentation

Troubleshooting Linearization

Linearization Troubleshooting Overview

Troubleshooting Checklist

If you do not get good linearization results, use the Linear Analysis Tool's troubleshooting tools. For example, use the Diagnostic Messages tab and the Linearization Inspector tab that are available in the Diagnostic viewer. To open the Diagnostic viewer, see Linearization Diagnostics.

You can also use the linearization result viewer for troubleshooting. To open the linearization result viewer:

  1. In the Plots and Results tab, select the linear model in the Linear Analysis Workspace.

  2. Click Result Viewer.

    Tip   To configure the linearization result viewer to open automatically when you linearize a model, in the Linear Analysis tab, check Result Viewer before linearizing.

The following table provides guidance in choosing a troubleshooting approach.

Where to LookLearn MoreSigns of Successful LinearizationSigns of Unsuccessful Linearization

Linear analysis plot, generated after linearization.

Create plots, as described in Analyze Results With Linear Analysis Tool Response Plots.

Time- or frequency-domain plot characteristics (e.g., rise time, bandwidth) capture system dynamics.

Response plot characteristics do not capture the dynamics of your system.

For example, Bode plot gain is too large or too small, or pole-zero plot contains unexpected poles or zeros.

Linear model equations in the Linearization result details dialog box.

View other linear model representations, as described in State-Space, Transfer Function, and Zero-Pole-Gain Equations of Linear Model.

State-space matrices show expected number of states.

You might see fewer states in the linear model than in your Simulink® model because, in many cases, the path between linearization input and output points do not reach all the model states.

Poles and zeros are in correct location.

Results show only D = 0 or D = Inf.

Linearization Inspector in the Diagnostic Messages tab of the Diagnostic viewer.

Check Individual Block Linearization Values

All the blocks you expect to include in the linearized model are listed with non-zero linearizations.

Missing blocks in the linearization path might indicate incorrect linearization input or output point placement, or that a critical block unexpectedly linearizes to zero, or that critical blocks are connected in a path to a block that linearizes to zero. See Check Linearization I/O Points Placement.

Extra blocks in the linearization path might indicate incorrect loop opening placement. See Check Loop Opening Placement.

Linearization diagnostics in the Diagnostic Messages tab of the Diagnostic viewer.

Linearization Diagnostics

Message indicates that there are no problematic blocks in the linearization.

One or more warnings about specific problematic blocks. See Check Individual Block Linearization Values.

State-Space, Transfer Function, and Zero-Pole-Gain Equations of Linear Model

You can view the linear model equations in the Linearization result dialog box of the Linear Analysis Tool.

To open the Linearization result details dialog box:

  1. In the Plots and Results tab, select the linear model in the Linear Analysis Workspace.

  2. Click Result Viewer.

Linear model equations display in state-space form, by default. Alternatively, you can view the Zero Pole Gain or Transfer Function representation in the Display linearization result as list.

Linearization Diagnostics

You can view diagnostic information about the linearization of specific blocks in the Diagnostic Messages tab of the Diagnostic Viewer of the Linear Analysis Tool. The Diagnostic Messages tab also suggests corrective actions.

Specifically, the Diagnostic Messages tab flags blocks with configuration warnings, unsupported blocks, and blocks that automatically linearize using numerical perturbation.

  1. Configure Linear Analysis Tool to log the diagnostics for the linearized model. In the Linear Analysis tab, before linearizing the model, check Diagnostic Viewer.

    The Diagnostic Viewer opens when you linearize the model.

      Tip   If you close the Diagnostic Viewer for a linear model, you can reopen it in the Plots and Results tab. Select the linear model in the Linear Analysis Workspace, and click Diagnostic Inspector.

  2. In the Diagnostic Messages dialog box, the Show diagnostics for drop-down list provides the following options:

    • all blocks in the Simulink model — Use when you suspect that certain blocks are inappropriately excluded from linearization. For example, blocks that linearize to zero (and shouldn't) are excluded from the linearization path.

    • blocks in the linearization path — Use when you are sure that all of the blocks that should be included in the linearization are included. That is, your linearization I/O points and any loop openings are set correctly, and blocks do not inappropriately linearize to zero.

    In this example, the model contains one block that is linearized using numerical perturbation.

  3. To investigate the flagged block, click the block link to highlight the corresponding block in the model.

    If the linearization results are poor, you can use the Linearization Inspector to explore linearization values of individual blocks.

Check Operating Point

To diagnose whether you used the correct operating point for linearization, simulate the model at the operating point you used for linearization.

The linearization operating point is incorrect when the critical signals in the model:

  • Have unexpected values.

  • Are not at steady state.

To fix problem, compute a steady-state operating point and repeat the linearization at this operating point.

 Related Examples

Check Linearization I/O Points Placement

After linearizing the model, check the block linearization values to determine which blocks are included in the linearization.

Blocks might be missing from the linearization path for different reasons.

Incorrect placement linearization I/O points can result in inappropriately excluded blocks from linearization. To fix the problem, specify correct linearization I/O points and repeat the linearization.

Blocks that linearize to zero (and other blocks on the same path) are excluded from linearization. To fix this problem, troubleshoot linearization of individual blocks, as described in Check Individual Block Linearization Values.

 More About

Check Loop Opening Placement

Incorrect loop opening placement causes unwanted feedback signals in the linearized model.

To fix the problem, check the individual block linearization values to identify which blocks are included in the linearization. If undesired blocks are included, place the loop opening on a different signal and repeat the linearization.

 More About

Check Phase of Frequency Response for Models with Time Delays

When the Bode plot shows insufficient lag in phase for a model containing time delays, the cause might be Padé approximation of time delays in your Simulink model.

See Models with Time Delays.

Check Individual Block Linearization Values

In the Linear Analysis Tool, check the Diagnostic Messages tab of the Diagnostic Viewer for blocks with configuration warnings, unsupported blocks, and blocks that automatically linearize using numerical perturbation. Click the block link to view the highlighted block in the model.

After identifying the blocks flagged in the Diagnostic Messages tab, view the linearization values of these blocks in the Linearization Inspector tab of the Diagnostic viewer, as follows:

  1. Open the Diagnostic Viewer for the linearization result. In the Linear Analysis Tool, in the Plots and Results tab, select the linear model in the Linear Analysis Workspace. In the Results section of the tab, click Diagnostic Inspector.

      Note:   To use the Diagnostic Viewer, you must configure Linear Analysis Tool to log the diagnostics for the linearized model before you linearize the model. See Linearization Troubleshooting Overview.

  2. In the Diagnostic viewer dialog box, click the Linearization Inspector tab.

  3. Select the specific subsystem or block whose linearization you want to examine. Navigate through the structure of your model in the left panel.

    For example, in the watertank model, select the Water-Tank System subsystem. Then, in Subsystem Blocks, select the Square Root block.

      Tip   Right-click anywhere in the Subsystem Blocks list, and select Show only blocks in linearization path. This action filters the list to include only the linearized blocks.

  4. Plot the response of the linearized block.

    For example, right-click the Square Root block under Subsystem Blocks, and select PlotBlock > Step Plot.

    The step response of the block is displayed.

  5. Troubleshoot individual blocks.

    Block or Subsystem TypeCommentPossible Fix
    Incompatible with linearizationSome blocks are implemented without analytic Jacobians and do not support numerical perturbation.Define custom linearization for affected block as an expression or function. See Controlling Block Linearization
    Event-based subsystemLinearization of event-based subsystems is zero because such subsystems do not trigger during linearization.When possible, specify a custom event-based subsystem linearization as a lumped average model or periodic function call subsystem. See Event-Based Subsystems (Externally Scheduled Subsystems).
    Simulink blocks in Discontinuities library, such as Deadzone, Saturation, and Quantizer blocksThe Discontinuities library blocks typically have poor linearization results when the operating point that is close to the discontinuity.

    If you want the linearization to be a gain of 1, select Treat as gain when linearizing in the block parameters dialog box.

    Define custom linearization for affected block as an expression or function. See Controlling Block Linearization.

    Model reference blockLinearization is not fully compatible with model reference blocks with Accelerator simulation mode.

    Always set each Model (model reference) block to use Normal simulation mode, instead of Accelerator mode.

    Blocks that linearize using numerical perturbation, instead of using preprogrammed analytic Jacobians

    Blocks that are located near discontinuous regions, such as S-Functions, MATLAB function blocks, or lookup tables, are sensitive to numerical perturbation levels. If the perturbation level is too small, the block linearizes to zero.

    Change the numerical perturbation level of the block. See Perturbation Level of Blocks Perturbed During Linearization.
     

    Blocks that have nondouble precision inputs signals and states linearize to zero.

    Use the Linearization Inspector tab to view the block linearization.

    Convert nondouble-precision data types to double precision. See Linearizing Blocks with Nondouble Precision Data Type Signals

Check Large Models

Troubleshooting the linearization of large models is easier using a divide-and-conquer strategy.

Systematically linearize specific model components independently and check whether that component has the expected linearization.

 Related Examples

Check Multirate Models

Incorrect sampling time and rate conversion method can cause poor linearization results in multirate models.

Change Sampling Time of Linear Model

The sampling time of the linear model displays in the Linearization results dialog box, below the linear equations.

By default, the software chooses the slowest sample time of the multirate model. If the default sampling time is not appropriate, specify a different linearization sample time and repeat.

In Linear Analysis Tool:

  1. In the Linear Analysis tab, click More Options.

  2. In the Options for exact linearization dialog box, in the Linearization tab, enter the desired sample time in the Enter sample time (sec) field. Press Enter.

    -1 specifies that the software linearizes at the slowest sample rate in the model.

    0 specifies a continuous-time linear model.

At the command line, specify the SampleTime linearization option.

For example:

opt = linearizeOptions;
opt.SampleTime = 0.01; 

Change Linearization Rate Conversion Method

When you linearize models with multiple sample times, such as a discrete controller with a continuous plant, a rate conversion algorithm generates a single-rate linear model. The rate conversion algorithm affects linearization results.

In the Linear Analysis Tool:

  1. In the Linear Analysis tab, click More Options.

  2. In the Options for exact linearization dialog box, in the Linearization tab, select the appropriate rate conversion method from the Choose rate conversion method list.

    Rate Conversion MethodWhen to Use
    Zero-Order HoldUse when you need exact discretization of continuous dynamics in the time-domain for staircase inputs.
    TustinUse when you need good frequency-domain matching between a continuous-time system and the corresponding discretized system, or between an original system and the resampled system.
    Tustin with PrewarpingUse when you need good frequency domain matching at a particular frequency between the continuous-time system and the corresponding discretized system, or between an original system and the resampled system.
    Upsampling when possible (Zero-Order Hold, Tustin, and Tustin with Prewarping)Upsample discrete states when possible to ensure gain and phase matching of upsampled dynamics. You can only upsample when the new sample time is an integer multiple of the sample time of the original system. Otherwise, the software uses an alternate rate conversion method.

At the command line, specify the RateConversionMethod linearization option.

For example:

opt = linearizeOptions;
opt.RateConversionMethod = 'tustin'; 

 See Also

 Related Examples

Was this topic helpful?