How do I create an animated errorbar?
조회 수: 5 (최근 30일)
이전 댓글 표시
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
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!