Skip to Main Content Skip to Search
Product Documentation

Managing Estimation Speed and Memory

Ways to Speed up Frequency Response Estimation

The most time consuming operation during frequency response estimation is the simulation of your Simulink model. You can try to speed up the estimation using any of the following ways:

Reducing Simulation Stop Time

The time it takes to perform frequency response estimation depends on the simulation stop time.

To obtain the simulation stop time from the input signal using the Linear Analysis Tool, select the input signal in the data browser. The simulation time will be displayed in the Variable Preview.

To obtain the simulation stop time from the input signal using MATLAB Code:

ts = generateTimeseries(input)
ts.Time(end)

where input is the sinestream or chirp input signal. ts.Time is the simulation stop time, which serves as an indicator of the frequency response estimation duration.

You can reduce the simulation time by modifying your signal properties.

Input SignalActionCaution
Sinestream

Decrease the number of periods per frequency NumPeriods, especially at lower frequencies.

You model must be at steady state to achieve accurate frequency response estimation. Reducing the number of periods might not excite your model long enough to reach steady state.

Chirp

Decrease the signal sample time Ts or the number of samples NumSamples.

The frequency resolution of the estimated response depends on the number of samples NumSamples. Decreasing the number of samples decreases the frequency resolution of the estimated frequency response.

For information about modifying input signals, see Modifying Input Signals.

Specifying Accelerator Mode

You can try to speed up frequency response estimation by specifying the Rapid Accelerator or Accelerator mode in Simulink.

For more information, see Accelerating Models in the Simulink documentation.

Using Parallel Computing

You can try to speed up frequency response estimation using parallel computing in the following situations:

In these situations, frequency response estimation performs multiple simulations. If you have installed the Parallel Computing Toolbox™ software, you can run these multiple simulations in parallel on multiple MATLAB sessions (pool of MATLAB workers).

For more information about using parallel computing, see Speeding Up Estimation Using Parallel Computing.

Speeding Up Estimation Using Parallel Computing

You can use parallel computing to speed up frequency response estimation that performs multiple simulations, as described in Using Parallel Computing.

Parallel computing for frequency response estimation requires the following operations:

Configuring MATLAB for Parallel Computing

After you configure your system for parallel computing, estimate using parallel computing. For further information, see Estimating Frequency Response Using Parallel Computing (MATLAB Code).

Configuring Parallel Computing on Multicore Processors.   With a Parallel Computing Toolbox license, you can establish a pool of parallel MATLAB sessions in addition to the MATLAB client.

To start a pool of MATLAB sessions in local configuration, type the following input at the MATLAB prompt:

matlabpool open local

To learn more, see the matlabpool reference page in the Parallel Computing Toolbox documentation.

Configuring Parallel Computing on Multiprocessor Networks.   Using parallel computing on a multiprocessor network requires Parallel Computing Toolbox software and the MATLAB® Distributed Computing Server™ software. To learn more, see the Parallel Computing Toolbox and MATLAB Distributed Computing Server documentation.

To configure a multiprocessor network for parallel computing:

  1. Create a user configuration file to include any model file dependencies. See Defining Configurations and the FileDependencies reference page in the Parallel Computing Toolbox documentation.

  2. Open the pool of MATLAB workers using the user configuration file. See Applying Configurations in Client Code in the Parallel Computing Toolbox documentation.

    Opening the pool allows the remote workers to access the file dependencies included in the user configuration file.

Estimating Frequency Response Using Parallel Computing Using Linear Analysis Tool

After you configure your parallel computing settings, as described in Configuring MATLAB for Parallel Computing, you can estimate the frequency response of a Simulink model using the Linear Analysis Tool.

  1. In the Frequency Response Estimation tab of the Linear Analysis Tool, click Options.

    This action opens the Options for frequency response estimation dialog box.

  2. In the Parallel Options tab, select the Use the matlabpool during estimation check box.

    This action sets the estimation to use the matlabpool.

  3. (Optional) Click Add path dependecy....

    This action opens the Browse For Folder dialog box. Navigate and select the directory to add to the model path dependencies.

    Click OK.

      Tip   Alternatively, manually specify the paths in the Model path dependencies list. You can specify the paths separated with a new line.

  4. (Optional) Click Sync path dependencies from model.

    This action finds the model path dependencies in your Simulink model and adds them to the Model path dependencies list box.

Estimating Frequency Response Using Parallel Computing (MATLAB Code)

After you configure your parallel computing settings, as described in Configuring MATLAB for Parallel Computing, you can estimate the frequency response of a Simulink model.

  1. Find the paths to files that your Simulink model requires to run, called path dependencies.

    dirs = frest.findDepend(model)

    dirs is a cell array of strings containing path dependencies, such as referenced models, data files, and S-functions.

    For more information about this command, see the frest.findDepend reference page.

    To learn more about model dependencies, see What Are Model Dependencies? and Scope of Dependency Analysis in the Simulink documentation.

  2. (Optional) Check that dirs includes all path dependencies. Append any missing paths to dirs:

    dirs = vertcat(dirs,'\\hostname\C$\matlab\work')
  3. (Optional) Check that all workers have access to the paths in dirs.

    If any of the paths resides on your local drive, specify that all workers can access your local drive. For example, this command converts all references to the C drive to an equivalent network address that is accessible to all workers:

    dirs = regexprep(dirs,'C:/','\\\\hostname\\C$\\')
  4. Enable parallel computing and specify model path dependencies by creating an options object using the frestimateOptions command:

    options = frestimateOptions('UseParallel','on','ParallelPathDependencies',dirs)

      Tip   To enable parallel computing for all estimations, select the global preference Use the matlabpool in FRESTIMATE command check box in the MATLAB preferences. If your model has path dependencies, you must create your own frequency response options object that specifies the path dependencies before beginning estimation.

  5. Estimate the frequency response, as described in Estimating Frequency Response:

    [sysest,simout] = frestimate('model',io,input,options)

For an example of using parallel computing to speed up estimation, see the demo Speeding Up Frequency Response Estimation Using Parallel Computing.

Managing Memory During Frequency Response Estimation

Frequency response estimation terminates when the simulation data exceed available memory. Insufficient memory occurs in the following situations:

To avoid memory issues while estimating frequency response:

  1. Disable any signal logging in your Simulink model.

    To learn how you can identify which model components log signals and disable signal logging, see Signal Logging.

  2. Try one or more of the actions listed in the following sections:

  3. Repeat the estimation, as described in Estimating Frequency Response.

Model-Specific Ways to Avoid Memory Issues

To avoid memory issues, try one or more of the actions listed in the following table, as appropriate for your model type.

Model TypeAction
Models with fast discrete sample time specified at output point

Insert a Rate Transition block at the output point to lower the sample rate, which decreases the amount of logged data. Move the linearization output point to the output of the Rate Transition block before you estimate. Ensure that the location of the original output point does not have aliasing as a result of rate conversion.

For information on determining sample rate, see How to View Sample Time Information. If your estimation is slow, see Ways to Speed up Frequency Response Estimation.

Models with multiple input and output points (MIMO models)

Input-Signal-Specific Ways to Avoid Memory Issues

To avoid memory issues, try one or more of the actions listed in the following table, as appropriate for your input signal type.

Input Signal TypeAction
Sinestream
  • Remove low frequencies from your input signal for which you do not need the frequency response.

  • Modify the sinestream signal to estimate each frequency separately by setting the SimulationOrder option to OneAtATime. Then estimate using a frestimate syntax that does not request the simulated time-response output data, for example sysest = frestimate(model,io,input).

  • Use parallel computing to run independent simulations in parallel on different computers. See Speeding Up Estimation Using Parallel Computing.

  • Divide the input signal into multiple signals using fselect. Estimate the frequency response for each signal separately using frestimate. Then, combine results using fcat.

Chirp

Create separate input signals that divide up the swept frequency range of the original signal into smaller sections using frest.Chirp. Estimate the frequency response for each signal separately using frestimate. Then, combine results using fcat.

RandomDecrease the number of samples in the random input signal by changing NumSamples before estimating. See Time Response Is Noisy.

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS