Adjust view "distance" in 3D plot

10 views (last 30 days)
Adrian Wiley
Adrian Wiley on 14 Feb 2022
Commented: AndresVar on 14 Feb 2022
I'm currently making an animation to represent an orbit's x, y, and z coordinates. It works nearly perfectly, and have no issues overall. Though I have one slight issue
I have it calculate optimal viewing angles for the object, which I store in an array and use during the animation to assign values to the view function. It does exactly as it's supposed to, changing the viewing angle perfectly according to the position in the orbit the animation is currently displaying. However, something that I'm less "happy" with is the viewing distance. As the orbit is eliptical and bounding box cubical, the viewing distance will move out as it approaches the edge of a box and back in as it moves towards the middle. It's not a big issue, but simply annoying when it's constantly fluctuating inwards and outwards. Is there any way that I could set a distance manually? I can do the calculations for said distance on my own, but I'd rather not have to manually change the dimensions of the box if I don't have to.
  1 Comment
AndresVar
AndresVar on 14 Feb 2022
Is it changing distance because the plot size is changing?
Set the axis limit in the loop so it doesn't change. Specify Axis Limits - MATLAB & Simulink (mathworks.com)
OR set the axis once then set it to manual so it doesn't change Set axis limits and aspect ratios - MATLAB axis (mathworks.com)

Sign in to comment.

Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!