% 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

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

load st970630_amp;
dat=st970630_amp;
n=size(dat,1)
ch1=1
ch2=4
ch3=25
ch4=26
ch5=29
ch6=13
ch7=19

amax=0;
for j=1:n,
  om=dat(j,1);
  period(j)=6.283185307/om;
  amp1(j)=dat(j,ch1+1);
  amp2(j)=dat(j,ch2+1);
  amp3(j)=dat(j,ch3+1);
  amp4(j)=dat(j,ch4+1);
  amp5(j)=dat(j,ch5+1);
  amp6(j)=dat(j,ch6+1);
  amp7(j)=dat(j,ch7+1);
  if amp1(j) > amax
     amax=amp2(j);
     permax=period(j);
  end
end
amax
permax

amx=amax*1.1;
for j=1:n,
  amp1(j)=amp1(j)+amx*6;
  amp2(j)=amp2(j)+amx*5;
  amp3(j)=amp3(j)+amx*4;
  amp4(j)=amp4(j)+amx*3;
  amp5(j)=amp5(j)+amx*2;
  amp6(j)=amp6(j)+amx;
end

plot(period,amp1,'-',period,amp2,'-',period,amp3,'-',period,amp4,'-',period,amp5,'-',period,amp6,'-',period,amp7,'-')

axis([0 4 0 amx*7.1])
title(['Kogakuin EW (Ch1: Max =',num2str(amax),' at ',num2str(permax),' sec )'])
ylabel('Velocity Fourier Amplitude (kine*sec)')
xlabel('Period (sec)')
grid

print
%print wavex.ps


