I am generating a chart with the following command:
X = linspace(0, 1, n);
Y = linspace(0, 1, n);
surf(X,Y,B(:,:));
But how to make it generate an animation of the chart? I do not know anything about MATLAB ...
I am generating a chart with the following command:
X = linspace(0, 1, n);
Y = linspace(0, 1, n);
surf(X,Y,B(:,:));
But how to make it generate an animation of the chart? I do not know anything about MATLAB ...
It is relatively simple to generate animations in Matlab, you need to create a for
and at each step generate the desired output, call the function getframe
immediately after the function responsible for generating the graphic, this function works as a print screen in the graphic window, put each frame in a position and finally call the movie
function to execute the captured frames, the information you have passed so far is not enough to understand what the expected output of your algorithm is, you expect motion to occur in your linearly created vectors (X,Y)
or that they stay fixed and that only animation occurs in B
, you need to define this, a pseudo example of the steps explained above:
for j = 1:50
%A cada passo um surf diferente deve ser gerado de acordo com a sua necessidade
surf(X,Y,B(:,:));
%captura os frames
anima(j) = getframe;
end
%executa a animação no matlab
movie(anima,50)
Rotate this example to familiarize yourself with the result:
Z = peaks;
figure('Renderer','zbuffer');
for j = 1:20
surf(sin(2*pi*j/20)*Z,Z)
F(j) = getframe;
end
movie(F,20)