Animated Plotting position of body and pitch angle of actuator

12 views (last 30 days)
Hello,
I am a bit new to plotting in MATLAB, at least when it comes to doing anything fancy. As outputs of my simulator, I have x, y, z and velocity/acceleration data for the center of mass of an object. I am also tracking the attitude of the body frame as well as the attitude of the actuator (which can orient itself separately)
I was wondering how I might be able to create a plot that shows the body as a box with the body angle displayed over time. The position of the actuator would also be great to display as an oriented line above the box.
I have found a few functions that might work. for the trajectory data should I use animatedline? make hgt transform for the rotation of the object? I really am not sure where is the best place to start...
Thank you for your time.

Answers (1)

Alain Kuchta
Alain Kuchta on 20 Apr 2017
I recommend starting with the following documentation. This gives a good overview of animation techniques in MATLAB.
At a high level the code will need to:
  1. Set up all the required graphics objects. For example, a Line for the actuator, a Patch for the body, and an AnimatedLine for the trajectory. Group objects as needed inside transform objects.
  2. Loop over the simulation data. At each iteration, update each graphics object as needed to reflect the data.
  3. (optional) call pause to add some delay between updates
This example might be helpful to see transform objects in practice

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!