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:
The entries of the A, B, and C matrices are homogeneous in magnitude.
The model characteristics are insensitive to small perturbations in A, B, and C (in comparison to their norms).
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 Scaling State-Space Models to Maximize Accuracy.
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 Scale Your Model.
For models with satisfactory scaling, you can bypass automated scaling in the
Toolbox software. To do so, set the
Scaled property of
your state-space model to
1 (true). For information on how to
set this property, see the
set reference page.
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.
prescale command includes a Scaling Tool, 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, perform the following steps:
Open Scaling Tool.
Specify frequency axis limits.
Specify frequency band for maximum accuracy.
Save the scaling.
For an example of using the Scaling Tool on a real model, see Scaling State-Space Models to Maximize Accuracy.
For more information about scaling models from the command line, see the
prescale reference page.
To open the Scaling Tool for a state-space model named
The Scaling Tool resembles one shown in the following figure.
The Scaling Tool contains the following plots:
The Frequency Response Gain plot helps you determine the frequency band over which you want to maximize scaling.
For SISO systems, this plot shows the gain of your model. For MIMO systems, the plot shows the principle gain (largest singular value) of your model.
The Frequency Response Accuracy plot allows you to view the accuracy tradeoffs for your model when maximizing accuracy in a particular frequency bands.
This plot shows the following information:
Relative accuracy of the response of the original unscaled model in red
Relative accuracy of the response of the scaled model in blue
Best achievable accuracy when using independent scaling at each frequency in brown
When you compute some model characteristics, such as
the frequency response or the system zeros, the software produces
the exact answer for some perturbation of the model you specified.
The relative accuracy is a measure of the
worst-case relative gap between the frequency response of the
original and perturbed models. The perturbation accounts for
rounding errors during calculation. Any relative accuracy value
1 implies poor accuracy.
If the blue Scaled curve is close to the brown Pointwise Optimal curve in a particular frequency band, you already have the best possible accuracy in that frequency band.
You can change the limits of the plot axis to view a particular frequency band of interest in the Scaling Tool. 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.
To return to the default display, select the Auto check box.
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.
You can use the Frequency Response Gain plot, which plots the gain of your model, to view the dynamics in your model to help determine the frequency band to maximize accuracy.
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.
To return to the default scaling, select the Auto check box.
When you find a good scaling for your model, save the scaled model as follows:
Click Save Scaling.
This action opens the Save to Workspace dialog box.
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.
Scaling information, including:
Frequencies used to test accuracy
Relative accuracy at each test frequency
For details about the scaling
information, see the
prescale reference page.
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