% A "m" file for Matlab. After making a "wave_dat" file from "grfft.f", you
% can plot waveforms using Matlab. A post script data is stored in the 
% "wave.ps" file.

clear
%close

%fig=figure('Units','centimeters','Position',[0.0 0.0 21.0 29.5]...
%,'PaperUnits','centimeters','PaperPosition',[0.0 0.0 21.0 29.5]);

fig=figure('Units','centimeters','Position',[0.0 0.0 21.0 26.0]...
,'PaperUnits','centimeters','PaperPosition',[0.0 0.0 21.0 26.0]);


dur=30
amax=0.1

load wave_dat;
size(wave_dat)
nt=size(wave_dat,1);

for i=1:nt,
t(i)=wave_dat(i,1);
x(i)=wave_dat(i,2);
y(i)=wave_dat(i,3);
z(i)=wave_dat(i,4);
end
xmax=max(x);ymax=max(y);zmax=max(z);
xmin=min(x);ymin=min(y);zmin=min(z);

subplot(3,1,1)
plot(t,x)
title(['Radial (max=',num2str(xmax),', min=',num2str(xmin),')'])
ylabel('Velocity (cm/s)')
%axis([0 dur -amax amax])

subplot(3,1,2)
plot(t,y)
title(['Transverse (max=',num2str(ymax),', min=',num2str(ymin),')'])
ylabel('Velocity (cm/s)')
%axis([0 dur -amax amax])

subplot(3,1,3)
plot(t,z)
title(['Down-UP (max=',num2str(zmax),', min=',num2str(zmin),')'])
ylabel('Velocity (cm/s)')
xlabel('time (sec)')
%axis([0 dur -amax amax])

print wave.ps
