Assignments‎ > ‎Motor Dynamics‎ > ‎

Motor Simulation

Open-Loop Motor Simulation

Assignment Overview:

In this assignment you will simulate the motor and potentiometer assembly as it starts up under full voltage (12VDC). In this part of the project use the parameters shown below and friction is neglected. In a future assignment, you will identify more accurately the motor parameters, system inertia, and friction.


    1. Write out the Ordinary Differential Equation (ODE) that needs to be solved.
    2. Write Matlab code so that it models the motor dynamics neglecting friction. Simulate motion for the first 100 milliseconds.
      1. Use the Euler method with time steps of 0.01, 0.001, and 0.0001 seconds. 
      2. Use the Runge-Kutta method with ODE45 using the default options.
    3. For each simulation use the tic and toc functions to record the computation time to perform the simulation. Also record the final angular position and velocity of the motor.

Turn in:

    1.  A brief description of the problem including assumptions and parameters used.
    2. Write out key equations used in code.
    3.  Matlab Code. Use good programming practices as described in Good Programming Practices.
    4. Plots of:
      1. Motor Position Output vs. Time for 100 milliseconds for all simulations on one axes.
      2.  Motor Velocity Output vs. Time for 100 milliseconds for all simulations on one axes.
    5. Table of final motor position, motor velocity, computation time, for each simulation method and time step.
    6. Brief discussion of appropriate time step for an Euler simulation, the trade-off in terms of computation time, and comparison with the Runge-Kutta method. 


    • Use meaningful and consistent variable names. See: Good Programming Practices.
    • Include concise documentation within your code.
    • Within your Matlab code the units for angles should be in radians, but plotted outputs should be in degrees.
    • Always label axes on plots and include units.
    • Use legend or directly indicate curves on plots. If black and white printouts are used, then labeling should not solely depend on color.
    • Use mark up tool to indicate areas of interest on plot.
    • When comparing 2 curves (e.g. theory and experiment), plot curves on the same axes.

Parameters you will need:  

The motor used is Maxon part number 339281. See spec sheet. You will need to use the:

  • Torque constant and Speed constant
  • Rotor inertia

The power supply is a 12VDC with a maximum 3amp output (switching power supply).

Note, the motor is rated for 24V, but we are using a 12V power supply. The values for the torque constant and speed constant do not change, but the stall torque and no load speed ratings will be 50% of their listed values when operated at 12V.


o   Motor Dynamics

o   Euler Method

o   Good Programming Practices

Nate Delson,
Sep 9, 2015, 8:09 PM