回覆列表
  • 1 # 使用者8554722719173

    comet應該不可以同時繪製多個質點,可以用下面這種方法~

    假設有3個質點,質點的軌跡分別存在x1,y1,x2,y2,x3,y3

    pausetime=0.01; %設定繪圖速度

    head1=line(-5,1,"color","r", "marker",".","markersize",15);%設定質點標記的顏色,大小,線條

    head2=line(-5,1,"color","b", "marker",".","markersize",15);

    head3=line(-5,1,"color","k", "marker",".","markersize",15);

    for i=1:length(x1)

    set(head1,"xdata",x1(i),"ydata",y1(i));%設定質點1的運動

    set(head2,"xdata",x2(i),"ydata",y2(i));%設定質點2的運動

    set(head3,"xdata",x3(i),"ydata",y3(i));%設定質點3的運動

    pause(pausetime);

    drawnow;

    end

    這樣就可以畫很多個點的運動了~

  • 中秋節和大豐收的關聯?
  • 做錯車和錯過車哪個更可惜?