% A "m" file for Matlab. After making a "amp_dat" file from "grfft.f", you
% can plot ampforms using Matlab. A post script data is stored in the 
% "amp.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]);



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

for i=1:nt,
f(i)=amp_dat(i,1)/6.2831853;
xr=amp_dat(i,2);
xi=amp_dat(i,3);
yr=amp_dat(i,4);
yi=amp_dat(i,5);
zr=amp_dat(i,6);
zi=amp_dat(i,7);
x(i)=sqrt(xr*xr+xi*xi);
y(i)=sqrt(yr*yr+yi*yi);
z(i)=sqrt(zr*zr+zi*zi);
end
xmax=max(x);ymax=max(y);zmax=max(z);


subplot(3,1,1)
plot(f,x,'-')
title(['NS (max=',num2str(xmax),')'])
ylabel('Fourier Amplitude')
%axis([0 dur -amax amax])

subplot(3,1,2)
plot(f,y,'-')
title(['EW (max1=',num2str(ymax),')'])
ylabel('Fourier Amplitude')
%axis([0 dur -amax amax])

subplot(3,1,3)
plot(f,z,'-')
title(['UD (max1=',num2str(zmax),')'])
ylabel('Fourier Amplitude')
xlabel('Frequency (Hz)')
%axis([0 dur -amax amax])

print amp.ps
