Matlab: Smooth Rotating Animation for Line Plots

I recently became stuck trying to create an animation which consists of a smooth rotation of a viewpoint around the Lorenz attractor. Methods I use for changing viewpoints with respect to surface objects were creating jerky, lagging animations when applied to my line plot.

This will work for any 3D line plot:

axis vis3d
fps = 60; sec = 10;
vidObj = VideoWriter('plotrotation.avi');
vidObj.Quality = 100;
vidObj.FrameRate = fps;
for i=1:fps*sec

This results in the following smooth animation:

2 thoughts on “Matlab: Smooth Rotating Animation for Line Plots”

  1. You are a God amongst men!!! I have been trying for over a week to get a 3D plot to rotate smoothly. It kept jumping around as it rotated, zooming in and out, giving weird perspectives, etc. etc. I’ve scoured every Stackoverflow and mathworks post on the issue, consulted every matlab coder I know, NO ONE could figure it out.

    The solution? “axis vis3d”

    I have no idea why those 9 characters solved all of the world’s problems but they did. Thanks.

Comments are closed.