forked from b2kay/shallow_water2D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimation.m
35 lines (33 loc) · 805 Bytes
/
animation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
clear all; close all;clc;
files = glob('./eta/*.dat')
x_spacing = 10;
y_spacing = 10;
dx = 500/x_spacing+1;
dy = 500/y_spacing+1;
tx = linspace (0, 500, dx)';
ty = linspace (0, 500, dy)';
[xx, yy] = meshgrid (tx, ty);
abspath = './png/'
az = 40;
el = 45;
fh = figure('visible','off');
for i=1:numel(files)
[~, name] = fileparts (files{i});
eval(sprintf('%s = load("%s", "-ascii");', name, files{i}));
%eval(sprintf('%s = transpose(%s);', name, name));
eval(sprintf('%s = %s(2:%d,2:%d);', name, name, dy+1,dx+1));
% create figure.
clf
eval(sprintf('surf(xx, yy, %s);', name));
view(az, el);
hidden on
axis tight
xlabel('x')
ylabel('y')
zlim([-0.07 0.95])
colorbar
caxis([-0.002 0.05])
drawnow
framename = sprintf('./png/eta%05d.png', i);
print(fh, framename);
endfor