figure('Color','w');
h1 = animatedline;
h1.Color = 'r';
h1.LineWidth = 1.0;
h1.LineStyle = '-.';
 
h2 = animatedline;
h2.Color = 'b';
h2.LineWidth = 1.0;
h2.LineStyle = '-';
 
axis([0,4*pi,-1,1])
x = linspace(0,4*pi,1000);
y1 = sin(x);
y2 = cos(x);
for k = 1:length(x)
    addpoints(h1,x(k),y1(k));
    addpoints(h2,x(k),y2(k));
    drawnow;
end

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐