clear all
close all
g = 9.81;

T = 6:2:16;

h = 0:100;
h = h';

w = 2*pi./T;
k = w.^2/g;



decay = exp(-h*k);


figure
plot(h,100*decay);
set(gca,'FontSize',16);
xlabel('depth');
ylabel('% of surface velocity');
title('Absolute velocity (relative to surface)');
legend('T = 6s','T = 8s','T = 10s','T = 12s','T = 14s','T = 16s');


figure
plot(h,100*(1-decay));
set(gca,'FontSize',16);
xlabel('depth');
ylabel('% of surface velocity');
title('Differential Velocity (relative to surface)');
legend('T = 6s','T = 8s','T = 10s','T = 12s','T = 14s','T = 16s');

A_PM = [0.725 1.225 1.9 2.75 3.8 4.95];

figure
plot(T,A_PM,T,A_PM.*w);
set(gca,'FontSize',16);
xlabel('Period (s)');
legend('PM Wave Amplitude (m)','PM Surface Velocity Magnitude (m/s)','Location','NorthWest');


figure
plot(T,A_PM.*w.*exp(-0*k),T,A_PM.*w.*exp(-10*k),T,A_PM.*w.*exp(-20*k),T,A_PM.*w.*exp(-25*k),T,A_PM.*w.*exp(-30*k),T,A_PM.*w.*exp(-40*k));
set(gca,'FontSize',16);
title('Velocity Magnitude at Various Depths')
xlabel('Period (s)');
ylabel('m/s');
legend('h = 0m','h = 10m','h = 20m','h = 25m','h = 30m','h = 40m','Location','NorthWest');

figure
plot(T,A_PM.*w.*(1-exp(-0*k)),T,A_PM.*w.*(1-exp(-10*k)),T,A_PM.*w.*(1-exp(-20*k)),T,A_PM.*w.*(1-exp(-25*k)),T,A_PM.*w.*(1-exp(-30*k)),T,A_PM.*w.*(1-exp(-40*k)),T,A_PM.*w.*(1-exp(-50*k)));
set(gca,'FontSize',16)
title('Velocity Differential from surface at Various Depths')
xlabel('Period (s)');
ylabel('m/s');
legend('h = 0m','h = 10m','h = 20m','h = 25m','h = 30m','h = 40m','h = 50m','Location','NorthWest');

figure
plot(T,A_PM.*w.*(1-exp(-0*k)),T,A_PM.*w.*(1-exp(-100*k)),T,A_PM.*w.*(1-exp(-200*k)),T,A_PM.*w.*(1-exp(-300*k)),T,A_PM.*w.*(1-exp(-400*k)),T,A_PM.*w.*(1-exp(-500*k)));
set(gca,'FontSize',16)
title('Velocity Differential from surface at Various Deep Depths')
xlabel('Period (s)');
ylabel('m/s');
legend('h = 0m','h = 100m','h = 200m','h = 300m','h = 400m','h = 500m','Location','NorthWest');

figure
plot(T,A_PM.*w.*(1-exp(-30*k)));
set(gca,'FontSize',16)
title('Apparant Heave amplitude at 30m depth')
xlabel('Period (s)');
ylabel('m/s');
legend('h = 0m','h = 100m','h = 200m','h = 300m','h = 400m','h = 500m','Location','NorthWest');
