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

clear
%close

load xyz_dat;
size(xyz_dat)
nt=xyz_dat(1,1)
nob=xyz_dat(1,2)

load y_dat;
size(y_dat)
load time_dat;
size(time_dat)
f=max(time_dat)
amax=max(y_dat)

for j=1:nt,
  wave_d(j)=y_dat(j);
end
a=-1.1*min(wave_d)
for j=1:nt,
  wave_d(j)=y_dat(nt*(nob-1)+j);
end
b=+1.1*max(wave_d)

hold on
for i=1:nob,
  for j=1:nt,
    wave_d(j)=y_dat(nt*(i-1)+j)+a+amax*(i-1)/2;
  end
  plot(time_dat,wave_d)
end
hold off

title('Y')
set(gca, 'box','on')
axis([0 f 0 a+b+amax*(nob-1)/2])
ylabel('amplitude of Y')
xlabel('time (sec)')

print wavey.ps


