function [Heave, Surge, Sway, Pitch, Roll, Yaw, ND1] = RAOPlot_AMP(A,O)
% [Heave, Surge, Sway, Pitch, Roll, Yaw, ND1] = RAOPlot_AMP(A,O)
%
% This function plots the RAO vs. wave height normalized by
% the OWC chamber diameter.
%
% Inputs: 
% A - Opening Ratio (%)
% O - Incident Angle (degrees)
%
% Outputs:
% Heave - Z RAO
% Surge - Y RAO
% Sway - X RAO
% Pitch - RY RAO
% Roll - RX RAO
% Yaw - RZ RAO
close all

T= 2;
H = [5 6.5 8 9.5 11 14];

for k = 1:length(A)
    for i = 1:length(H)
        [~,~,~,~,~,~, RAO(i,:)] = RAOsolve(H(i),T,A(k),O);
        ND1(i) = H(i)/22.5;

        Heave(i,k) = RAO(i,3);
        Surge(i,k) = RAO(i,2);
        Sway(i,k) = RAO(i,1);

        Pitch(i,k) = rad2deg(RAO(i,4));
        Roll(i,k) = rad2deg(RAO(i,5));
        Yaw(i,k) = rad2deg(RAO(i,6));
    end
end

acon = aconfig('LineWidth',2,'Colormap',[0 0 0],'MarkerSize',10,'LineStyles','o:|x:|s:|d:|+:','FontSize',20,'fontWeight','bold','Grid',1);
afigure(acon)
ax = gca;
set(ax,'FontSize',20,'fontWeight','bold','ticklabelinterpreter','latex');
afigure(1,acon)
plot(ND1,Heave)
xlabel('H/D','interpreter','latex')
ylabel('Heave (m/m)','interpreter','latex')
axis([0.2 0.9 0 1])
legend('$\alpha$= 0.5\%','$\alpha$= 0.7\%','$\alpha$= 1.0\%','$\alpha$= 1.5\%','$\alpha$= 2.0\%','Location','northeast','interpreter','latex')

afigure(2,acon)
plot(ND1,Surge)
xlabel('H/D','interpreter','latex')
ylabel('Surge (m/m)','interpreter','latex')
axis([0.2 0.9 0 2])
legend('$\alpha$= 0.5\%','$\alpha$= 0.7\%','$\alpha$= 1.0\%','$\alpha$= 1.5\%','$\alpha$= 2.0\%','Location','northeast','interpreter','latex')


afigure(3,acon)
plot(ND1,Sway)
xlabel('H/D','interpreter','latex')
ylabel('Sway (m/m)','interpreter','latex')
% axis([5 55 0 0.25])
legend('0.5','0.7','1.0','1.5','2.0','Location','northeast','interpreter','latex')

% cd('C:\Users\ulmn\Documents\MATLAB\projects\2021\TEAMERUHOWC\sw\Plots\Floating\RegRAO')
% saveas(figure(1),'RegRAO_Heave_AMP.fig')
% saveas(figure(1),'RegRAO_Heave_AMP.png')
% 
% saveas(figure(2),'RegRAO_Surge_AMP.fig')
% saveas(figure(2),'RegRAO_Surge_AMP.png')
% 
% saveas(figure(3),'RegRAO_Sway_AMP.fig')
% saveas(figure(3),'RegRAO_Sway_AMP.png')
% cd('C:\Users\ulmn\Documents\MATLAB\projects\2021\TEAMERUHOWC\sw')


afigure(4,acon)
plot(ND1,Pitch)
xlabel('H/D','interpreter','latex')
ylabel('Pitch ($^o$/m)','interpreter','latex')
axis([0.2 0.9 0 120])
legend('$\alpha$= 0.5\%','$\alpha$= 0.7\%','$\alpha$= 1.0\%','$\alpha$= 1.5\%','$\alpha$= 2.0\%','Location','northeast','interpreter','latex')

afigure(5,acon)
plot(ND1,Roll)
xlabel('H/D')
ylabel('Roll (deg/m)','interpreter','latex')
% axis([5 55 0 5])
legend('0.5','0.7','1.0','1.5','2.0','Location','northeast')


afigure(6,acon)
plot(ND1,Yaw)
xlabel('H/D')
ylabel('Yaw (deg/m)','interpreter','latex')
% axis([5 55 0 5])
% 
% legend('0.5','0.7','1.0','1.5','2.0','Location','northeast')
% saveas(figure(4),'RegRAO_Pitch_AMP.fig')
% saveas(figure(4),'RegRAO_Pitch_AMP.png')
% 
% saveas(figure(5),'RegRAO_Roll_AMP.fig')
% saveas(figure(5),'RegRAO_Roll_AMP.png')
% 
% saveas(figure(6),'RegRAO_Yaw_AMP.fig')
% saveas(figure(6),'RegRAO_Yaw_AMP.png')