How to make a matlab movie out of a quiver?

12 views (last 30 days)
Hello, I am trying to make a .avi movie out of a quiver plot of vector fields. The code which I am running makes a very large video file and the video doesn't look smooth. How can I alter my code such that I can make the run smooth just like the animation the quiver makes when the code is run. My code looks like:
rpm = [1000 900 800];
range = 0:0.2:2*pi;
minrpm = min(rpm);
maxrpm = max(rpm);
y = [0 0 0];
Fy =[1 .5 1];
yy = [92 90 150];
alpha_y = degtorad(yy);
x = [0 0 0];
Fx = [.8 .7 1.1];
xx = [90 100 80];
alpha_x = degtorad(xx);
hFig = figure; % to define Figure Properties
set(hFig, 'Position', [0 0 1000 1000]);
for e = 1:length(range);
q = quiver(x(1), y(1), Fx(1).*cos(alpha_x(1)+range(e)), Fy(1).*cos(alpha_y(1)+range(e)),1,'LineWidth',2);
axis([-1.1 1.1 -1.1 1.1]);
M(e) = getframe;
end
% movie(M,20,200);
movie2avi(M,'myMovie.avi','fps',50,'quality',10);

Answers (1)

Walter Roberson
Walter Roberson on 1 Dec 2015
You should be switching to VideoWriter()
You should probably use a higher 'quality'
Your playback system might not be able to handle 50 fps of uncompressed video.
You are only creating 32 frames at your 50 fps. Are you playing it with looping turned on? If so then it might not necessarily be smooth when it loops back to the beginning. You can experiment with that by writing several copies of M, [M,M,M,M] for example. Or if you were switching to VideoWriter you could add M several times before closing the file (this would be more memory efficient.)

Categories

Find more on View and Analyze Simulation Results in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!