# MATLAB: How to speed up an animation plot

3d plotanimated plotdrawnowinterpolationmoviepausesurfsurf plot

I don't know if this a little extreme but I need to plot 480 plots. I'm combining them in an animated plot so I can see how the plot fluctuates over time. However, it's taking an unbelievably long time (timed it and it took almost 37 minutes) to get through all 480 plots. The transitions aren't smooth and are very laggy. It also makes my computer lag. This is the code I have. Can't seem to figure out the problem. Should I make changes to it or turn this animated plot into a movie instead? If yes, how do I do so? Thanks in advance!
 figure  hold on; for k = 1:(length(h)*added_points)    for i = 1:30        for j = 1:30            vqVal = zeros(1,1);             if ~isempty(cellArray{i,j})                % new cell array                vqVal = cellArray{i,j}(k);            end            vqHrPax{i,j} = vqVal;         end    end        h = linspace(103.6,104,30);    y = linspace(1.5,1.25,30);    [X,Y] = meshgrid(h,y);     V = cell2mat(vqHrPax);     view(3);    %surf(X,Y,V);    n = 300;    xq = linspace(103.6,104,n);    xy = linspace(1.5,1.25,n);     [Xq,Yq] = meshgrid(xq,xy);    Vq = interp2(X,Y,V,Xq,Yq,'cubic');    surf(Xq,Yq,Vq); % plots interpolated data    % for loop to change title of each plot     xlabel('Longitude'); ylabel('Latitude');    % str = sprintf('Pax at  Hour %d', k);    % title(str)    s = 0;    for l = s:(s+20)        if k > s && k <=(s+20)            str = sprintf('Hour %d', ((s/20)+1));            title(str);        end        s = s + 20;    end    axis tight    colormap default    drawnow    % pause(0.001) end

h = linspace(103.6,104,30);y = linspace(1.5,1.25,30);   [X,Y] = meshgrid(h,y);
V = zeros(30, 30);for iC = 1:900  if ~isempty(cellArray{i,j})    V(iC) = cellArray{i,j}(k);  endend
% Replace:% surf(Xq,Yq,Vq); % plots interpolated data% By:if isempty(hSurf)  hSurf = surf(Xq,Yq,Vq); % plots interpolated dataelse  set(hSirf, 'XData', Xq, 'YData', Yq, 'ZData', Vq);end