주요 콘텐츠

frestimateOptions

Options for frequency response estimation

Description

Use frestimateOptions to create an option set for the frestimate function.

Creation

Description

options = frestimateOptions creates a frequency response estimation options object, options, with default settings. Pass this object to the function frestimate to use these options for frequency response estimation.

options = frestimateOptions(PropertyName=Value) creates an option set and sets Properties using one or more name-value arguments

example

Properties

expand all

Option to perform computation in parallel using a parallel pool of workers, specified as one of these values:

  • "off" — Run in serial on the MATLAB® client. Enabling parallel computing may result in improved estimation performance.

  • "auto" — Use a parallel pool if one is open or if MATLAB can automatically create one. If a parallel pool is not available, run in serial on the MATLAB client.

  • "on" — Use a parallel pool if one is open or if MATLAB can automatically create one. If a parallel pool is not available, throw an error.

If you do not have a parallel pool open and automatic pool creation is enabled, MATLAB opens a pool using the default cluster profile. To use a parallel pool to run computations in MATLAB, you must have Parallel Computing Toolbox™. For more information, see Run MATLAB Functions with Automatic Parallel Support (Parallel Computing Toolbox).

A string array that specifies the path dependencies required to execute the model to estimate. All the workers in the parallel pool must have access to the folders listed in 'ParallelPathDependencies'.

Block paths of time-varying source blocks to hold constant during frequency response estimation, specified as an array of Simulink.BlockPath objects. To identify time-varying source blocks that can interfere with frequency response estimation, use frest.findSources.

Examples

collapse all

Open model.

mdl = "scdspeed_ctrlloop";
open_system(mdl)

Convert referenced subsystem to normal mode.

set_param("scdspeed_ctrlloop/Engine Model","SimulationMode","Normal");

Obtain input/output points from the model and create sinestream input signal.

io = getlinio(mdl);
in = frest.Sinestream( ...
    Frequency=logspace(1,2,10), ...
    NumPeriods=30,...
    SettlingPeriods=25);

Identify time-varying sources in the model.

srcblks = frest.findSources(mdl)
srcblks = 
  1×4 BlockPath array with properties:

    SubPath
    isLoadingModel
    isSavingModel

Create option set for estimation and specify the time-varying source blocks.

opts = frestimateOptions(BlocksToHoldConstant=srcblks);

Estimate the frequency response.

[sysest,simout] = frestimate(mdl,io,in,opts);

To demonstrate a dependency on a file that is not in the current working folder, move the model files to a temporary folder and return the path to that folder. The pathdepSetup helper function also adds the temporary folder to the MATLAB® search path.

tempPath = pathdepSetup;

Open the Simulink® model.

mdl = 'scdpathdep';
open_system(mdl)

Obtain the model dependency path.

dirs = frest.findDepend(mdl)
dirs = 1×1 cell array
    {'C:/myTempFiles/tpda2d7c67_2b14_432a_846b_eebf94cbdadb'}

The resulting path is on the local drive C:/.

If you are using remote workers, 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 remote workers.

dirs = regexprep(dirs,'C:/','\\\\hostname\\C$\\')

Enable parallel computing and specify the model path dependencies.

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

You can now use these options for frequency response estimation using parallel computing.

io = getlinio(mdl);
in = frest.Sinestream('SimulationOrder','OneAtATime');
frd = frestimate(mdl,io,in,options);
Starting parallel pool (parpool) using the 'Processes' profile ...
04-Nov-2025 09:47:36: Job Queued. Waiting for parallel pool job with ID 1 to start ...
04-Nov-2025 09:48:38: Job Queued. Waiting for parallel pool job with ID 1 to start ...
Connected to parallel pool with 4 workers.

After estimating the frequency response, you can close the model.

bdclose(mdl)

Return the model files to the current working folder and remove the temporary folder from the path.

pathdepCleanup(tempPath)

Alternatives

You can enable parallel computing for all models with no path dependencies. To do so, in the MATLAB preferences dialog box, click Simulink® Control Design™. Then, select the Use the parallel pool when you use the "frestimate" command option. This global setting persists from session to session until you change this option.

When you select this option and use the frestimate command, you do not need to provide an frestimateOptions object.

If your model has path dependencies, you must create your own frequency response options object that specifies the path dependencies. Use the ParallelPathDependencies option before beginning the estimation.

Version History

Introduced in R2010a

expand all