How do I create an animated errorbar?

조회 수: 5 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2018년 3월 20일
답변: MathWorks Support Team 2018년 4월 17일
Is there a way to create an animated errorbar similar to an animated line?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2018년 3월 20일
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개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by