% 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]);


load fft1_d;
rise=fft1_d(1,1)
disp=fft1_d(1,2)
nt=fft1_d(1,3)

for i=1:nt+1,
f(i)=fft1_d(1+i,1);
ar(i)=fft1_d(1+i,2);
ai(i)=fft1_d(1+i,3);
aa(i)=sqrt(ar(i)*ar(i)+ai(i)*ai(i));
end

for i=1:nt,
t(i)=fft1_d(nt+2+i,1);
w1(i)=fft1_d(nt+2+i,2);
w2(i)=fft1_d(nt+2+i,3);
end

subplot(2,1,1)
plot(f,ar,'--',f,ai,'-.',f,aa)
title('Solid: Abs; Dashed: Real; Dash-Dot: Imag')
ylabel('Fourier Amplitude')
xlabel('frequency (Hz)')

subplot(2,1,2)
plot(t,w1,'-',t,w2,'-.')
title('Solid: Original Wave; Dashed: FFT + inv. FFT')
ylabel('Wave')
xlabel('time (sec)')

print fft1.ps
