xPC Target    

Parameter Tuning with MATLAB

You use the MATLAB functions to change block parameters. With these functions you do not need to set Simulink to External Mode, and you do not need to connect Simulink with the target application.

You can download parameters to the target application while it is running or between runs. This feature lets you change parameters in your target application without rebuilding the Simulink model.

After you download a target application to the target PC, you can change block parameters using xPC Target functions. This procedure uses the Simulink model xpcosc.mdl as an example, and assumes you have created and downloaded the target application for that model.

  1. In the MATLAB Command Window, type either
  1. The target PC displays the following message.

  1. Display a list of parameters. Type either
  1. and then type

    The MATLAB window displays a list properties for the target object.

    The parameter names (P0, P1, . . .P6) are properties of the target object.

  1. Change the gain. For example, to change the Gain1 block, type either
  1. As soon as you change parameters, the changed parameters in the target object are downloaded to the target application. The target PC displays the following message.

    And the plot frame updates the signals after running the simulation with the new parameters.

  1. Stop the target application. In the MATLAB Command Window, type either
  1. The target application on the target PC stops running, and the target PC displays the following messages.


  Parameter Tuning with xPC Target Remote Control Tool Parameter Tuning with Simulink External Mode