%% Create Animation of Streaming Data
% Create an animation of a line growing as it accumulates 2,000 data
% points. Use |drawnow| to display the changes on the screen after each
% iteration through the loop.

% Copyright 2015 The MathWorks, Inc.


h = animatedline;
axis([0 4*pi -1 1])
x = linspace(0,4*pi,2000);

for k = 1:length(x)
    y = sin(x(k));
    addpoints(h,x(k),y);
    drawnow
end