% 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 mat0_dat;
nob=mat0_dat(1,1);
nt=mat0_dat(1,2);
dt=mat0_dat(1,3);

load matz_dat;
amax=max(matz_dat);
amin=min(matz_dat);
if amin < -amax
   amax=-amin;
end

for j=1:nt,
  t(j)=dt*(j-1);
end
f=max(t);

a=amax;
aa=amax/4;
hold on
for i=1:nob,
  for j=1:nt,
    wave_d(j)=matz_dat(nt*(i-1)+j)+a+aa*(i-1);
  end
  plot(t,wave_d)
end
hold off

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

print wavez.ps


