Making a MATLAB movie including the title, axis, x-y labels, time display

5 views (last 30 days)
Dear colleague,
I want to make a movie file (avi) which when played back on a non-matlab PC includes the title, axis, x-y labels, time display etc. So can you teach me the techniques? (My PC version is Windows 7 64 bit and Matlab R2012a)
This is the code;
clc; clear all; close all;
c = 0.9; % 1/c: soliton velocity
x = linspace(-20, 20, 201); % x domain
dx = x(2) - x(1); % x interval
dt = dx/c; % t interval
t_end = 18; % end value of t
t = 0:dt:t_end; % t domain
Nx = length(x); % number of subintervals x
Nt = length(t); % number of subintervals t
ex_sol = zeros(Nx, Nt);
for ex = 1:Nx
for et = 1:Nt
if x(ex) < 0 && t(et)/(x(ex) - x(1)) <= 1/c
ex_sol(ex, et) = ana(x(ex), t(et), c);
elseif x(ex) > 0 && t(et)/(x(ex) - x(end)) >= -1/c
ex_sol(ex, et) = ana(x(ex), t(et), c);
elseif x(ex) == 0
ex_sol(ex, et) = ana(x(ex), t(et), c);
else
ex_sol(ex, et) = 0;
end
end
end
writerObj = VideoWriter('test.avi');
writerObj.FrameRate = 5;
open(writerObj)
axis tight
set(gca,'nextplot','replacechildren');
set(gcf,'Renderer','zbuffer');
figure(8)
for im = 1:Nt
plot(x, ex_sol(:, im));
xlabel('x');
ylabel('u_exact(x, t)')
gh = getframe;
writeVideo(writerObj, gh)
end
close(writerObj)

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!