Robotics and Mechatronics
Use these examples to learn how to control motors, compare their characteristics, and develop electric actuators.
Featured Examples
Brushless DC Motor
How a system-level model of a brushless DC motor (i.e. a servomotor) can be constructed and parameterized based on datasheet information. The motor and driver are modeled as a single masked subsystem. If viewing the model in Simulink®, select the Motor and driver block, and type Ctrl+U to look under the mask and see the model structure.
Compound Motor Design Optimization
Find design parameters that optimize a compound motor torque-speed curve to match the desired curve.
DC Motor Control
A cascade speed-control structure for a DC motor. A PWM controlled four-quadrant Chopper is used to feed the DC motor. The Control subsystem includes the outer speed-control loop, the inner current-control loop, and the PWM generation. The total simulation time (t) is 4 seconds. At t = 1.5 seconds, the load torque increases. At t = 2.5 seconds, the reference speed is changed from 1000 rpm to 2000 rpm.
DC Motor Control (Lead-Lag)
A lead-lag speed-control structure for a DC motor. A PWM controlled four-quadrant Chopper is used to feed the DC motor. The Control subsystem includes a lead-lag controller, a constant gain, and the PWM generation. The total simulation time (t) is 4 seconds. At t = 1.5 seconds, the load torque increases. At t = 2.5 seconds, the reference speed is changed from 1000 rpm to 2000 rpm.
DC Motor Control (RST)
An RST speed-control structure for a DC motor. A PWM controlled four-quadrant Chopper is used to feed the DC motor. The Control subsystem includes the RST controller with control horizon of 30, and the PWM generation. A sensor measures the rotor speed with a delay of 5ms. The total simulation time (t) is 4 seconds. At t = 1.5 seconds, the load torque increases. At t = 2.5 seconds, the reference speed is changed from 1000 rpm to 2000 rpm.
DC Motor Control (Smith Predictor)
A Smith Predictor speed-control structure for a DC motor. A PWM controlled four-quadrant Chopper is used to feed the DC motor. The Control subsystem includes the Smith predictor controller, and the PWM generation. A sensor measures the rotor speed with a delay of 5ms. The total simulation time (t) is 4 seconds. At t = 1.5 seconds, the load torque increases. At t = 2.5 seconds, the reference speed is changed from 1000 rpm to 2000 rpm.
DC Motor Control (State-Feedback and Observer)
A state-feedback speed-control structure for a DC motor. A PWM controlled four-quadrant Chopper is used to feed the DC motor. The Control subsystem includes the state-feedback control loop, and the PWM generation. The state vector includes the rotor speed which is measured, and the dc motor current, which is estimated using an observer. Both the observer and state-feedback controller are synthesized by pole placement using the state-space model of the system. The total simulation time (t) is 4 seconds. At t = 1.5 seconds, the load torque increases. At t = 2.5 seconds, the reference speed is changed from 1000 rpm to 2000 rpm.
Hybrid Linear Actuator
A hybrid actuator consisting of a DC motor plus lead screw in series with a piezoelectric stack. The DC motor and lead screw combination supports large displacements (tens of millimeters), but is dynamically slow when tracking the reference demand x_ref. Conversely the piezoelectric stack only supports a maximum displacement of +-0.1mm, but has a very fast dynamic response. Combining the two actuator technologies creates a large stroke actuator with highly precise positioning.
Import Efficiency Map Data from Motor-CAD
Import efficiency map data from Motor-CAD to parameterize the Simscape™ Electrical™ Motor & Drive (System Level) block. This provides fast system-level simulation capability of a motor drive whilst still making accurate predictions about losses.
Linear Electric Actuator (Motor Model)
How to develop a model of an uncontrolled linear actuator using datasheet parameter values. The actuator consists of a DC motor driving a 6.25:1 worm gear which in turn drives a 3mm lead screw to produce linear motion. Manufacturer data for the actuator defines the no-load linear speed (26mm/s), rated load (1000N), rated-load linear speed (19mm/s), and maximum current (5A). The maximum static force is 4000N and the rated voltage is 24V DC.
Linear Electric Actuator with Control
A detailed implementation model of a controlled linear actuator. The actuator consists of a DC motor driving a worm gear which in turn drives a lead screw to produce linear motion. The model includes quantization effects of the Hall-effect sensor and the implementation of the control in analog electronics. There are multiple variant subsystems in this model that have models at varying levels of fidelity.
Model a Motor Drive with Multiple Intermittent Torque Limits
Model a motor drive with multiple intermittent over-torque limits by using Simscape™ Electrical™.
- Since R2024a
- Open Model
Motor Torque-Speed Curves
A comparison of the torque-speed characteristics for five different motor types. To select the motor type, right-click on the Electric Motor block and select Block Parameters (Subsystem) from the context menu. In the new window, specify the desired motor using the Label mode active choice parameter. All motors have been sized for roughly the same mechanical power rating.
Control DC Motor with PWM Voltage Source and H-Bridge Driver
Control a DC motor by using the Controlled PWM Voltage and H-Bridge blocks. The DC Motor block delivers a mechanical power of 10 W at 2500 rpm and turns at a no-load speed of 4000 rpm when the DC supply voltage is 12 V. Consequently, if you set the PWM reference voltage to its maximum value of 5 V, the motor runs at 4000 rpm. If you set the PWM reference voltage to 2.5 V, the motor runs at approximately 2000 rpm. To achieve fast simulation, this example sets the Simulation mode parameter of the Controlled PWM Voltage and H-Bridge blocks to Averaged
. To validate the averaged behavior, set the Simulation mode
parameter to PWM
in both the Controlled PWM Voltage and H-Bridge blocks.
Stepper Motor Averaged Mode
The Stepper Motor simulating in Stepping and Averaged simulation modes. The purpose of Averaged mode is faster simulation for any loads that do not cause slip. To avoid incorrect interpretation of results, the stepper motor has an approximate detection of slip which can be set to generate a warning or an error.
Stepper Motor with Control
Model a controlled permanent magnet stepper motor by using the Stepper Motor and Stepper Motor Driver blocks. The model has two controller options: one to control position and one to control speed. To change the controller type, right-click the Controller subsystem, select Variant > Label Mode Active Choice, and then select Position or Speed. The stepper has a full step size of 1.8 degrees. In position control mode, the input to the Ref port is the desired number of steps. In speed control mode, the input to the Ref port is the desired number of steps per second.
Unipolar Stepper Motor Averaged Mode
The Unipolar Stepper Motor simulating in Stepping and Averaged simulation modes. The purpose of Averaged mode is faster simulation for any loads that do not cause slip. To avoid incorrect interpretation of results, the stepper motor has an approximate detection of slip which can be set to generate a warning or an error.
Unipolar Stepper Motor with Control
Model a controlled permanent magnet stepper motor by using the Unipolar Stepper Motor and Unipolar Stepper Motor Driver blocks. The model has two controller options: one to control position and one to control speed. To change the controller type, right-click the Controller subsystem, select Variant > Label Mode Active Choice, and then select Position or Speed. The stepper has a full step size of 1.8 degrees. In position control mode, the input to the Ref port is the desired number of steps. In speed control mode, the input to the Ref port is the desired number of steps per second.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)