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.
The MATLAB window displays a list properties for the target object.
ShowParameters = On Parameters= PROP VALUE PARAMETER NAME BLOCK NAME P0 0.000000 InitialCondition Integrator1 P1 4.000000 Amplitude Signal Generator P2 20.000000 Frequency Signal Generator P3 1000000.0 Gain Gain P4 0.000000 InitialCondition Integrator P5 400.00000 GainGain1 P6 1000000.0 GainGain2
The parameter names (P0, P1, . . .P6) are properties of the target object.
And the plot frame updates the signals after running the simulation with the new parameters.
![]() | Parameter Tuning with xPC Target Remote Control Tool | Parameter Tuning with Simulink External Mode | ![]() |