Animated Plotting position of body and pitch angle of actuator

12 次查看(过去 30 天)
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.

回答(1 个)

Alain Kuchta
Alain Kuchta 2017-4-20
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

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by