How do I create an animated errorbar?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 20 Mär. 2018
Beantwortet: MathWorks Support Team
am 17 Apr. 2018
Is there a way to create an animated errorbar similar to an animated line?
Akzeptierte Antwort
MathWorks Support Team
am 20 Mär. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Animation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!