Effacer les filtres
Effacer les filtres

Hello, I want to create a video showing 3 separate plots progressing forward as an animation. Now, the data (x1, y1, x2, y2, x3, y3) is obtained from experimental results and not aperiodic equation. How do I do this?

1 vue (au cours des 30 derniers jours)
t1 = [0 264.04 616.04 968.04 1056.04 2552.04 3256.04 5104.04 5896.04 8008.04 8800.04 9504.04]; v1 = [31.48 29.213 29.501 29.01 29.357 27.655 27.362 26.923 26.879 26.701 26.655 26.583];
t2 =[0 264 616 880 1056 3080 3608 4136 6072 7744 11176 12936]; v2 = [25.962 27.362 26.357 27.918 27.364 23.989 23.271 23.081 22.155 21.179 20.955 20.826];
t3 =[0 263.96 351.96 967.96 4751.96 5279.96 5719.96 6599.96 7391.96 8535.96 9063.96 10119.96]; v3=[28.838 28.091 28.397 28.699 17.616 14.33 6.409 5.035 2.936 1.972 1.424 0];
h1 = animatedline; axis([0,12500,0,35])
for k1 = 1:length(t1) addpoints(h1,t1(k1),v1(k1)); drawnow end

Réponses (1)

Sam McDonald
Sam McDonald le 26 Oct 2016
I understand that you want to create an animation of three data sets being plotted over time. The code you provided performs the basic plotting that you need. Creating two additional 'animatedline' objects will allow you to plot the separate data. Then, you need to capture each snapshot and save them all to a video. After the 'drawnow' command in your 'for' loop, include this line of code
F(k1) = getframe(gcf);
This will save each frame to a structure named 'F'. After the 'for' loop, include the following code to create and save the frames to a video file:
video = VideoWriter('video.avi');
open(video);
writeVideo(video,F);
close(video);
For more information on the 'VideoWriter' object, refer to:

Catégories

En savoir plus sur Animation dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by