## Specify Time-Domain Requirements

In the Sensitivity Analyzer, you can specify the following time-domain requirements:

After you specify the constraints, you can see if the requirements are satisfied by evaluating the design requirements. For more information, see Evaluate Design Requirements.

### Match Model Outputs to Measured Signals

You can specify a signal matching requirement to match model outputs to measured signals. This requirement is also known as an experiment in the Parameter Estimator. To specify a signal matching requirement:

1. In the Sensitivity Analyzer, in the New Requirement drop-down list, select Signal Matching.

A new signal matching requirement appears in the Requirements area of the app. An Edit Signal Matching dialog box opens where you specify this requirement. You specify model output and input signals, and assign measured data to them. You can also specify initial state values.

2. In the Outputs panel of the Edit Signal Matching dialog box, select output signals, and import output data. You can select more than one output signal, but you can have only one data set for a signal. If you have multiple data sets, create multiple requirements.

1. Select the model output signals that you want to add the requirement to.

By default, the root-level model output ports and logged signals are already listed in the Outputs panel. To remove existing outputs from the signal matching requirement, click the corresponding . To add other output signals, click Select Measured Output Signals.

The Select Outputs dialog box opens to display the root-level model Outport blocks and logged signals.

2. In the Simulink® model window, click the signal to add. The Select Outputs dialog box updates to show the new signals. To add these signals as outputs, select the corresponding check boxes. Click OK.

3. In the Edit Signal Matching dialog box Outputs panel, for each output, import measured output data in one of the following ways:

• Import signal data from spreadsheets or text files — Click , and import the data from the file.

• Import data from the MATLAB® workspace — Suppose that the signal data and time data are in the `EyeData` and `time` column vectors in the workspace, respectively. Specify the output data as `[time,EyeData]`.

If your data is stored in a time-series object, `t`, specify the output data as `[t.time,t.outputdata]`.

After importing data, to view or edit the data, click .

3. (Optional) Select input signals and import input data in the Inputs panel.

You can have more than one input signal, but you can have only one data set for a signal. If you have multiple data sets, create multiple requirements. By default, the root-level model input ports are already listed in the Inputs panel. Remove or add inputs, and import input data, in the same way as described for the output data.

4. (Optional) Specify initial states values in the Initial States panel.

By default, the initial conditions specified in the model are used for evaluating the requirement. To specify initial conditions other than the defaults, click Select Initial States. In the Select Model States dialog box, select the states to specify, and click OK.

The selected states appear in the Edit Signal Matching dialog box Initial States panel. Specify the initial states.

5. Close the Edit Signal Matching dialog box.

The signal matching requirement in the Requirements area of the app is updated with the specified characteristics.

6. (Optional) Plot the requirement.

1. In the Sensitivity Analysis tab of the app, in the Requirements area, select the requirement.

2. In the Plots tab of the app, select the plot type to generate a graphical display of the requirement.

Note

You can preprocess the data using the preprocess tools in the Experiment Plot tab. For more information, see Preprocess Data.

### Specify Piecewise-Linear Lower and Upper Bounds

To specify upper and lower bounds on a signal:

1. In the Sensitivity Analyzer, in the New Requirement drop-down list, select Signal Bound.

A Create Requirement dialog box opens where you specify upper or lower bounds on a signal. A new requirement with the name specified in Name appears in the Requirements area of the app.

2. Select the requirement type from Type.

3. Specify the edge start and end times and corresponding amplitude in the Time (s) and Amplitude columns.

4. Click to specify additional bound edges.

Select a row and click to delete a bound edge.

5. In the Select Signals to Bound area, select a logged signal to apply the requirement to.

If you have already selected signals, as described in Specify Signals to Log, they appear in the list. Select the corresponding check-box.

If you have not selected a signal to log:

1. Click . A Create Signal Set dialog box opens where you specify the logged signal.

2. In the Simulink model window, click the signal to which you want to add a requirement.

The Create Signal Set dialog box updates and displays the name of the block and the port number where the selected signal is located.

3. Select the signal and click to add it to the signal set.

4. In Signal set field, enter a name for the selected signal set.

Click . A new variable, with the specified name, appears in the Create Requirement dialog box.

6. Select the check-box corresponding to the signal, and close the Create Requirement dialog box.

The requirement in the Requirements area of the app is updated with the specified characteristics.

7. (Optional) Plot the requirement.

1. In the Sensitivity Analysis tab of the app, in the Requirements area, select the requirement.

2. In the Plots tab of the app, select the plot type to generate a graphical display of the requirement.

The plot is populated when you perform evaluation. A positive value indicates that the requirement has been violated.

You can now evaluate the requirement. For more information, see Evaluate Design Requirements.

Alternatively, you can add a Check Custom Bounds block to your model to specify piecewise-linear bounds.

### Specify Signal Property Requirements

To specify signal property requirements:

1. In the Sensitivity Analyzer, in the New Requirement drop-down list, select Signal Property. A Create Requirement dialog box opens where you specify signal property requirements. A new requirement with the name specified in Name appears in the Requirements area of the app.

2. In the Specify Property area, specify a signal property requirement using the Property and Type lists and the Bound box.

3. In the Select Signals to Bound area, select the logged signal to which you want to apply the requirement.

The signal selected must have numeric type data (either floating-point or integer). Also, if the property selected is ```Signal median```, `Signal variance`, or `Signal interquartile range`, then the signal data must be floating-point (either double or single).

If you have already selected a signal, as described in Specify Signals to Log, the signal appears in the list. Select the corresponding check box for that signal.

If you have not selected a signal to log:

1. Click . A Create Signal Set dialog box opens where you specify the logged signal.

2. In the Simulink model window, click the signal to which you want to add a requirement.

The Create Signal Set dialog box updates and displays the name of the block and the port number where the selected signal is located.

3. Select the signal and click to add it to the signal set.

4. In Signal set field, enter a name for the selected signal set.

Click . A new variable, with the specified name, appears in the Create Requirement dialog box.

4. Select the check-box corresponding to the signal, and close the Create Requirement dialog box.

The requirement in the Requirements area of the app is updated with the specified characteristics.

You can now evaluate the requirement. For more information, see Evaluate Design Requirements. When you perform evaluation, a positive requirement value indicates that the requirement has been violated.

### Specify Step Response Characteristics

To apply a step response requirement to a signal in your model, specify the step response characteristics as follows:

1. Select a step response requirement from the Sensitivity Analyzer.

In the New Requirement drop-down list of the app, in the New Time Domain Requirement section, select Step Response Envelope.

A Create Requirement dialog box opens where you specify the step response requirements on a signal. A new requirement with the name specified in Name appears in the Requirements area of the app.

2. Specify the step response characteristics:

• Initial value — Input level before the step occurs

• Step time — Time at which the step takes place

• Final value — Input level after the step occurs

• Rise time — The time taken for the response signal to reach a specified percentage of the step range. The step range is the difference between the final and initial values.

• % Rise — The percentage of the step range used with Rise time to define the overall rise time characteristics.

• Settling time — Time taken until the response signal settles within a specified region around the final value. This settling region is defined as the final step value plus or minus the settling range, defined in % Settling.

• % Settling — The percentage of the step range value that defines the settling range of settling time characteristic specified in Settling time.

• % Overshoot — The amount by which the response signal can exceed the final value. This amount is specified as a percentage of the step range. The step range is the difference between the final and initial values.

• % Undershoot — The amount by which the response signal can undershoot the initial value. This amount is specified as a percentage of the step range. The step range is the difference between the final and initial values.

3. Specify the signal to be bound.

To apply this requirement to a model signal, in the Select Signals to Bound area, select a logged signal to which you will apply the requirement.

If you have already selected a signal to log, as described in Specify Signals to Log, it appears in the list. Select the corresponding check-box.

If you have not selected a signal to log:

1. Click . The Create Signal Set dialog box opens where you specify the logged signal.

2. In the Simulink model window, click the signal to which you want to add a requirement.

The Create Signal Set dialog box updates and displays the name of the block and the port number where the selected signal is located.

3. Select the signal and click to add it to the signal set.

4. In Signal set field, enter a name for the selected signal set.

Click . A new variable, with the specified name, appears in the Create Requirement dialog box.

4. Select the check-box corresponding to the signal, and close the Create Requirement dialog box.

The requirement in the Requirements area of the app is updated with the specified characteristics.

5. (Optional) Plot the requirement.

1. In the Sensitivity Analysis tab of the app, in the Requirements area, select the requirement.

2. In the Plots tab of the app, select the plot type to generate a graphical display of the requirement.

The plot is populated when you perform evaluation. A positive value indicates that the requirement has been violated.

You can now evaluate the requirement. For more information, see Evaluate Design Requirements.

Alternatively, you can use the Check Step Response Characteristics block to specify step response bounds for a signal.

### Track Reference Signals

Use reference tracking to force a model signal to match a desired signal. To track a reference signal:

1. In the Sensitivity Analyzer, in the New Requirement drop-down list, select Signal Tracking.

A Create Requirement dialog box opens where you specify the reference signal to track. A new requirement with the name specified in Name appears in the Requirements area of the app.

2. Define the reference signal by entering vectors, or variables from the workspace, in the Time vector and Amplitude fields.

Click to use the new amplitude and time vector as the reference signal.

3. Specify how the optimization solver minimizes the error between the reference and model signals using the Tracking Method list:

• `SSE` — Reduces the sum of squared errors

• `SAE` — Reduces the sum of absolute errors

4. In the Specify Signal to Track Reference Signal area, select a logged signal to apply the requirement to.

If you already selected a signal to log, as described in Specify Signals to Log, they appear in the list. Select the corresponding check-box.

If you have not selected a signal to log:

1. Click . A Create Signal Set dialog box opens where you specify the logged signal.

2. In the Simulink model window, click the signal to which you want to add a requirement.

The Create Signal Set dialog box updates and displays the name of the block and the port number where the selected signal is located.

3. Select the signal and click to add it to the signal set.

4. In Signal set field, enter a name for the selected signal set.

Click . A new variable, with the specified name, appears in the Create Requirement dialog box.

5. Select the check-box corresponding to the signal, and close the Create Requirement dialog box.

The requirement in the Requirements area of the app is updated with the specified characteristics.

6. (Optional) Plot the requirement.

1. In the Sensitivity Analysis tab of the app, in the Requirements area, select the requirement.

2. In the Plots tab of the app, select the plot type to generate a graphical display of the requirement.

The plot is populated when you perform evaluation. A positive value indicates that the requirement has been violated.

Alternatively, you can use the Check Against Reference block to specify a reference signal to track.

### Impose Elliptic Bound on Phase Plane Trajectory of Two Signals

You can impose an elliptic bound on the phase plane trajectory of two signals in your Simulink model. The phase plane trajectory is a plot of the two signals against each other. You specify the radii, center, and rotation of the bounding ellipse. You also specify whether you require the trajectory of the two signals to lie inside or outside the ellipse.

The following image shows the bounding ellipse and an example of the phase plane trajectory of two signals.

The X-Y plane is the phase plane defined by the two signals. rx and ry are the radii of the bounding ellipse along the x and y axes, and θR is the rotation of the ellipse about the center. The ellipse center is at (x0,y0). In the image, the phase plane trajectory of the signals lies within the bounding ellipse for all time points t1 to tn.

To specify the elliptical bound requirement:

1. In the Sensitivity Analyzer, in the New Requirement drop-down list, select Ellipse Region Constraint.

In the Create Requirement dialog box, specify the signals and elliptical bound. A new requirement with the name specified in Name appears in the Requirements area of the app.

1. Specify the two signals that you want to impose the requirement on. The signals define the X-Y plane of the bounding ellipse. To specify the signals, click the corresponding Select buttons.

When you click Select, the Create Signal Set dialog box opens.

In the Simulink model window, click the signal to which you want to add the requirement. The Create Signal Set dialog box updates with the name of the block and the port number where the selected signal is located. Select the signal, and click to add it to the signal set.

Once you have specified the logged signal in the Create Signal Set dialog box, the signal appears in the Create Requirement dialog box.

2. Specify the radii of the bounding ellipse as real positive finite values in Semi-axis length. You specify rx and ry that are the x-axis and y-axis radii before any rotation about the ellipse center.

3. Specify the location of the center of the bounding ellipse in Center. You specify x0 and y0, the x and y coordinates of the center, as real finite values.

4. Specify the angle of rotation of the ellipse about its center as a real finite scalar in Angle (rad).

5. Specify the bound Type as one of the following:

• `'<='` — Ellipse is an upper bound. The phase plane trajectory of the two signals should lie inside or on the ellipse.

• `'>='` — Ellipse is a lower bound. The phase plane trajectory of the two signals should lie outside or on the ellipse.

1. Close the Create Requirement dialog box.

The requirement created in the Requirements area of the app is updated with the specified characteristics.

2. (Optional) Plot the requirement.

1. In the Sensitivity Analysis tab of the app, in the Requirements area, select the requirement.

2. In the Plots tab of the app, select the plot type to generate a graphical display of the requirement.

The plot is populated when you perform evaluation. A positive value indicates that the requirement has been violated.

You can now evaluate the requirement. For more information, see Evaluate Design Requirements.

### Specify Custom Requirements

You can specify custom requirements, such as minimizing system energy. To specify custom requirements:

1. In the Sensitivity Analyzer, in the New Requirement drop-down list, select Custom Requirement.

A Create Requirement dialog box opens where you specify the reference signal to track. A new requirement with the name specified in Name appears in the Requirements area of the app.

2. Specify the requirement type in the Type drop-down menu.

3. Specify the name of the function that contains the custom requirement in Function. The field must be specified as a function handle using `@`. The function must be on the MATLAB path. Click to review or edit the function.

If the function does not exist, clicking opens a template MATLAB file. Use this file to implement the custom requirement. The default function name is `myCustomRequirement`.

4. (Optional) To prevent the solver from considering specific parameter combinations, select Error if constraint is violated. Use this option for parameter-only constraints.

During an optimization iteration, the solver first evaluates requirements with this option selected.

• If the constraint is violated, the solver skips evaluating any remaining requirements and proceeds to the next combination of parameters in the parameter set.

• If the constraint is not violated, the solver evaluates the remaining requirements for the current combination of parameter values. If any of the remaining requirements bound signals or systems, then the solver simulates the model.

Note

If you select this check box, then do not specify signals or systems to bound. If you do specify signals or systems, then this check box is ignored.

5. (Optional) Specify the signal or system, or both, to be bound.

You can apply this requirement to model signals, or a linearization of your Simulink model (requires Simulink Control Design™ ), or both.

Click Select Signals and Systems to Bound (Optional) to view the signal and linearization I/O selection area.

• To apply this requirement to a model signal:

In the Signal area, select a logged signal to which you will apply the requirement.

If you have already selected a signal to log, as described in Specify Signals to Log, it appears in the list. Select the corresponding check box.

If you have not selected a signal to log:

1. Click . A Create Signal Set dialog box opens where you specify the logged signal.

2. In the Simulink model window, click the signal to which you want to add a requirement.

The Create Signal Set dialog box updates and displays the name of the block and the port number where the selected signal is located.

3. Select the signal and click to add it to the signal set.

4. In Signal set field, enter a name for the selected signal set.

Click . A new variable, with the specified name, appears in the Create Requirement dialog box.

• To apply this requirement to a linear system:

1. Specify the simulation time at which the model is linearized in Snapshot Times. For multiple simulation snapshot times, specify a vector.

2. Select the linearization input/output set from the Linearization I/O area.

If you have already created a linearization input/output set, it appears in the list. Select the corresponding check box.

If you have not created a linearization input/output set, click to open the Create linearization I/O set dialog box. For more information on using this dialog box, see Create Linearization I/O Sets.