MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
edit quarc_scripting_for_srv02_position_control_sim_demo.m; quarc_srv02_position_control_sim_demoQUARC Scripting for SRV02 Position Control Simulation Demo
This example consists of two files; an M-file and a Simulink model. It demonstrates how to use the QUARC MATLAB functions to create a MATLAB script that runs and manages a Simulink model. The model is the position control simulation of the Quanser SRV02 plant. The MATLAB script configures parameters needed for the model and runs the model 4 times, each time plotting the response in a MATLAB figure. In each run, a different value for the proportional gain of the controller is chosen.
Configuring the Demonstration
To set up the demonstration, click on the hyperlink included in the header of this document to open both files. You have to have the model opened before running the script. Once the model is opened in a Simulink model window, you are set to run the QUARC script.
Demonstration
To run the script, click on the F5 or use the icon in the editor's toolbar.
menu item from the menu in the M-file editor. You can also pressThe model gets built and starts running. The progress of the demonstration is reported in the MATLAB command window. Once all 4 runs are finished, a figure containing 4 plots is created. Each plot corresponds to the SRV02 motor shaft's actual angle position and the desired angle position for a particualr proportional gain Kp.
Running the example on a different target
To run the example model on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.
Once the QUARC SRV02 Position Control Simulation Demo model has been configured for running on a remote target, the script may be run on the local machine and it will build and deploy the code generated from the Simulink model to the remote target and run it there.
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.