function [P] = PeakPressure(H,T,A,O,M)
% [P] = PeakPressure(H,T,A,O,M)
% 
% This function determines Peak Pressure Drop Range using the findpeaks
% function.
%
% Inputs:
% H = Wave Height (cm)
% T = Period (s)
% A = Opening Ratio (%)
% M = 0 is Float. M = 1 is fixed.
%
% Outputs:
% P - Pressure Range

% Extract Raw Data
VarRos = dataExtract(H,T,A,O);

% Zeroshift and lowpass filter data.
VarRos = zeroshift(VarRos(:,1:23));
% VarRos(:,1:14)  - Wave Gauge Data
% VarRos(:,15)    - Fixed Model Surface Elevation
% VarRos(:,16:17) - Floating Model Pressure
% VarRos(:,18:19) - Fixed Model Pressure
% VarRos(:,20:23) - Load Cells
% VarRos(:,24)    - Time
% VarRos(:,25:27) - Translational Motion
% VarRos(:,28:30) - Rotational Motion

% Define Pressure for Fixed or Floating Model
if M == 0                                                                   % Floating Model Pressure.
    P1 = VarRos(:,17);  
elseif M ==1                                                                % Fixed Model Pressure
    P1(:,1) = VarRos(:,18);
    P1(:,2) = VarRos(:,19);
    P1 = mean(P1,2);
end


P2 = -1.*P1;                                                                % Negative values used to extract minimums

P1 = findpeaks(P1,'MinPeakHeight',0);
P2 = findpeaks(P2,'MinPeakHeight',0);
P = mean(P1)+mean(P2);                                                      % Determine range

