フィルターのクリア

2D plot and animation

39 ビュー (過去 30 日間)
Abhibrata Adhikary
Abhibrata Adhikary 2018 年 6 月 17 日
回答済み: Hussein 2023 年 7 月 8 日
figure();
plot(x(:,1),x(:,3),'b',x(:,5),x(:,7),'r',x(:,9),x(:,11),'g')
axis([0 15 0 15])
I want to make a animation to plot the graph as shown. i.e it should start with initial point and slowly goes giving me an animation. The normal graph is coming but I want it in the form of animation. Can someone please help me in this?

回答 (3 件)

Walter Roberson
Walter Roberson 2018 年 6 月 17 日
I recommend using animatedLine()
But you could also consider comet()
  13 件のコメント
Noah Prisament
Noah Prisament 2023 年 6 月 7 日
編集済み: Noah Prisament 2023 年 6 月 7 日
The "animatedline" now supports "datetime" values natively, so this functionality can now be acheived using "animatedline" and "addpoints" if the AnimatedLines are initialized as follows:
L1 = animatedline(NaT, NaN, 'color', 'b');
L2 = animatedline(NaT, NaN, 'color', 'r');
L3 = animatedline(NaT, NaN, 'color', 'g');
Walter Roberson
Walter Roberson 2023 年 6 月 7 日

サインインしてコメントする。


Abhibrata Adhikary
Abhibrata Adhikary 2018 年 6 月 17 日
Can you give an example to show the working?

Hussein
Hussein 2023 年 7 月 8 日
clc clear all close all Z = peaks; surf(Z) axis tight set(gca,'nextplot','replacechildren','visible','off') f = getframe; [im,map] = rgb2ind(f.cdata,256,'nodither'); im(1,1,1,20) = 0; for k = 1:20 surf(cos(2*pi*k/20)*Z,Z) f = getframe; im(:,:,1,k) = rgb2ind(f.cdata,map,'nodither'); end imwrite(im,map,'DancingPeaks.gif','DelayTime',0.1,'LoopCount',inf) %g443800

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by