| 1 |
function trisurfMovie(adj, nodes, data, name, T, xlimit, ylimit) |
| 2 |
[nx,nt] = size(data); |
| 3 |
|
| 4 |
minD = min(min(data)); |
| 5 |
maxD = max(max(data)); |
| 6 |
|
| 7 |
writerObj = VideoWriter([name,'.avi']); |
| 8 |
writerObj.FrameRate = nt/T; |
| 9 |
open(writerObj); |
| 10 |
|
| 11 |
%% Set up figure handle |
| 12 |
axsize = 400; |
| 13 |
h.fig = figure('Position', [100 100 4*axsize 4*axsize], 'Color', 'White'); |
| 14 |
h.patch = trisurf(adj, nodes(:,1), nodes(:,2), data(:,1)); |
| 15 |
h.ax = h.fig.CurrentAxes; |
| 16 |
h.EdgeColor = 'none'; |
| 17 |
%% Update patch and store movie |
| 18 |
for i=1:nt |
| 19 |
h.patch = handle(trisurf(adj, nodes(:,1), nodes(:,2), data(:,i))); |
| 20 |
axis(h.ax, 'equal', 'tight'); |
| 21 |
shading(h.ax, 'interp'); |
| 22 |
colormap(h.ax, 'bone'); |
| 23 |
h.ax.XTickMode = 'Manual'; |
| 24 |
h.ax.YTickMode = 'Manual'; |
| 25 |
h.ax.XTickLabelMode = 'Manual'; |
| 26 |
h.ax.YTickLabelMode = 'Manual'; |
| 27 |
h.ax.XLim = xlimit; |
| 28 |
h.ax.YLim = ylimit; |
| 29 |
h.ax.CLim = [minD, maxD]; |
| 30 |
h.ax.View = [0, 90]; |
| 31 |
h.ax.Visible = 'off'; |
| 32 |
|
| 33 |
drawnow(); |
| 34 |
|
| 35 |
writeVideo(writerObj, getframe(gcf)); |
| 36 |
|
| 37 |
if (mod(i,10)==0) |
| 38 |
fprintf('Frame %d %1.8e\n',i,norm(data(:,i))); |
| 39 |
end |
| 40 |
end |
| 41 |
close(writerObj); |