close all
clear all

load BuoyA5_Hs2

tf = 240; %seconds
tf = t(end);
N = 1024;

dt= tf/N;
f = 1/dt;  

ti = dt*(0:N-1);

zi = interp1(t,Elongation,ti);

zi_cubic = interp1(ti,zi,t,'spline');

figure('Position', [100 100 1000 600],'PaperOrientation','landscape','PaperPosition',[.5 .5 10,7.5])
subplot(2,1,1)
plot(t,Elongation,ti,zi);
title([name ': Hs = ' num2str(Hs) 'm, b = ' num2str(b) 'N/(m/s), plate:buoy size ratio = ' num2str(Ls*Lc/5)]);
legend('Model Results','Linear Reconstruction from 1024 points');
xlim([ti(1) ti(end)]);
ylabel('Elongation (m)');

subplot(2,1,2)
plot(t,Elongation,t,zi_cubic);
legend('Model Results','Cubic Spline Reconstruction from 1024 points');
xlim([ti(1) ti(end)]);
ylabel('Elongation (m)');
xlabel('time (s)');

print -dpdf TestMachineProfileReconstructions