clear all
close all
clc

% Read data
data=h5read('data_z.h5','/data_z');
coord=h5read('coordinates.h5','/coordinates');
time=h5read('time.h5','/time');


% Determine mesh for interpolation
delta_x = 1e-03;
delta_y = delta_x;
[X,Y] = meshgrid(min(coord(:,1)):delta_x:max(coord(:,1)), min(coord(:,2)):delta_y:max(coord(:,2)));

% Wavefield Animation
h2=figure;
set(h2,'Color','w','Position',[200 200 800 600])
set(gcf,'PaperPositionMode','auto');
box on

% Step size
step = 10;

% Loop over all time samples
for ii = 1 : step : size(data,2)/4    
    V = griddata(coord(:,1),coord(:,2),data(:,ii),X,Y);
    surf(X,Y,V)
    f = colorbar;
    f.Label.String = 'amplitude [m/s]';
    caxis([-2e-2 2e-2]);
    shading interp;
    colormap jet;
    xlabel('x (m)');
    ylabel('y (m)');
    view([0 90]);
    %axis tight
    axis square;
    pause(0.001);
end
