Products & Services Solutions Academia Support User Community Company

Learn more about Control System Toolbox   

Scaling State-Space Models

Why Scaling Is Important

When working with state-space models, proper scaling is important for accurate computations. A state-space model is well scaled when the following conditions exist:

Working with poorly scaled models can cause your model a severe loss of accuracy and puzzling results. An example of a poorly scaled model is a dynamic system with two states in the state vector that have units of light years and millimeters. Such disparate units may introduce both very large and very small entries into the A matrix. Over the course of computations, this mix of small and large entries in the matrix could destroy important characteristics of the model and lead to incorrect results.

For more information on the harmful affects of a poorly scaled model, see the Scaling Models to Maximize Accuracy demo.

When to Scale Your Model

You can avoid scaling issues altogether by carefully selecting units to reduce the spread between small and large coefficients.

In general, you do not have to perform your own scaling when using the Control System Toolbox™ software. The algorithms automatically scale your model to prevent loss of accuracy. The automated scaling chooses a frequency range to maximize accuracy based on the dominant dynamics of the model.

In most cases, automated scaling provides high accuracy without your intervention. For some models with dynamics spanning a wide frequency range, however, it is impossible to achieve good accuracy at all frequencies and some tradeoff of accuracy in different frequency bands is necessary. In such cases, a warning alerts you of potential inaccuracies. If you receive this warning, evaluate the tradeoffs and consider manually adjusting the frequency interval where you most need high accuracy. For information on how to manually scale your model, see Manually Scaling Your Model.

Manually Scaling Your Model

If automatic scaling produces a warning, you can use the prescale command to manually scale your model and adjust the frequency interval where you most need high accuracy.

The prescale command includes a Scaling Tool GUI, which you can use to visualize accuracy tradeoffs and to adjust the frequency interval where this accuracy is maximized.

To scale your model using the Scaling Tool GUI, you perform the following steps:

For an example of using the Scaling Tool GUI on a real model, see the Scaling Models to Maximize Accuracy demo.

For more information about scaling models from the command line, see the prescale reference page.

Opening the Scaling Tool GUI

To open the Scaling Tool GUI for a state-space model named sys, type

prescale(sys)

The Scaling Tool GUI resembles one shown in the following figure.

The Scaling Tool GUI contains the following plots:

Specifying the Frequency Axis Limits in the Scaling Tool GUI

You can change the limits of the plot axis to view a particular frequency band of interest in the Scaling Tool GUI. To view a particular frequency band, specify the band in the Show response in the frequency band fields.

This action updates the frequency axis of the Scaling tool to show the specified frequency band.

Specifying the Frequency Band for Maximum Accuracy in the Scaling Tool GUI

To adjust the frequency band where you want maximum accuracy, set a new frequency band in the Maximize accuracy in the frequency band fields. You can visualize accuracy tradeoffs by trying out different frequency bands and viewing the resulting relative accuracy across the frequency band of interest.

Each time you specify a new frequency band, the Frequency Response Accuracy plot updates with the result of the new scaling. Compare the Scaled curve (blue) to the Pointwise Optimal curve (brown) to determine where the new scaling is nearly optimal and where you need more accuracy.

Saving the Scaling in the Scaling Tool GUI

When you find a good scaling for your model, save the scaled model as follows:

  1. Click Save Scaling.

    This action opens the Save to Workspace dialog box.

  2. In the Save to Workspace dialog box, verify that any of the following items you want to save are selected, and specify variable names for these items.

    • Scaled model

    • Scaling information, including:

      • Scaling factors

      • Frequencies used to test accuracy

      • Relative accuracy at each test frequency

      For details about the scaling information, see the prescale reference page.

  3. Click OK.

    This action sets the State-Space (@ss) object Scaled property of your model to true. When you set this property to True, the Control System Toolbox algorithms skip the automated scaling of the model.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS