How do I create an animated errorbar?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 20 de Mzo. de 2018
Respondida: MathWorks Support Team
el 17 de Abr. de 2018
Is there a way to create an animated errorbar similar to an animated line?
Respuesta aceptada
MathWorks Support Team
el 20 de Mzo. de 2018
You cannot make an animated line directly from an errorbar, but you can draw the error bar in steps to make it appear animated:
x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
figure
ax = gca;
axis([0 100 10 110]);
for k = 1:numel(x)
% all values until the current time step
xVals = x(1:k);
yVals = y(1:k);
% error bars will be 5 units below and 10 units above each point
negativeDelta = 5*ones(1,numel(yVals));
positiveDelta = 10*ones(1,numel(yVals));
% draw the error bar
errorbar(ax,x(1:k),y(1:k),negativeDelta,positiveDelta);
% maintain axis limits since errorbar function will dynamically change
% the axis limits
axis([0 100 10 110]);
% pause between time steps to simulate animation
pause(0.5)
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!