% Delivered to the Government in Accordance with Contract FA8650-10-C-7080
% 
%  (c) 2011 United Technologies Corp.
% Developed with the sponsorship of the Defense Advanced Research Projects Agency (DARPA).
%  
% Permission is hereby granted, free of charge, to any person obtaining a copy of this data, including any software or models in source or binary form, as well as any drawings, specifications, and documentation (collectively "the Data"), to deal in the Data without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Data, and to permit persons to whom the Data is furnished to do so, subject to the following conditions:
%  
% The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Data.
%  
% THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, SPONSORS, DEVELOPERS, CONTRIBUTORS, OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA.
% 

% This script edits data so that it can be used in the surface fitting tool
h = 0;
Res = 100;       % Set the resolution of the plot

beta = linspace(0, 1, Res);
speed = linspace(0.5, 1.05, Res);

for count1 = 1:Res
Mass_nd = 0;
PR_nd = 0;
Efficiency_nd = 0;
Speed = speed(count1);
for count2 = 1:Res
    
Beta = beta(count2);

Mass_nd(count2) = interp2(Beta_HPT, Speed_HPT, Mass_HPT, Beta, Speed);
PR_nd(count2) = interp2(Beta_HPT, Speed_HPT, PR_HPT, Beta, Speed);
Efficiency_nd(count2) = interp2(Beta_HPT, Speed_HPT, Efficiency_HPT, Beta, Speed);


end


if abs(Speed- 1) < 0.01
hold on
plot(Mass_nd, PR_nd,'b');

elseif abs(Speed - 1.05)< 0.01 
plot(Mass_nd, PR_nd,'r');
hold on

else
    
plot(Mass_nd, PR_nd,'k');
hold on
end

end

clear('beta','speed', 'Beta', 'Speed', 'count1', 'count2', 'h', 'Mass_nd', 'PR_nd', 'Efficiency_nd', 'Res')