%% Compresor curves
clear all
close all
% This script carries out the regression for the compressor curves
% Curve points
x      = [ 2    5    6.67 8    9    10]; 
eta    = [ 0.69 0.78 0.74 0.70 0.69 0.68]; 
lambda = [ 0.98 0.93 0.90 0.89 0.87 0.86];

% Regression
p = polyfit(x,eta,3)
l = polyfit(x,lambda,1);

x2 = 2:0.2:10;
eta2 = polyval(p,x2);

%% Plot curves

fig(1) = figure(1);
plot(x2,eta2)
hold on
scatter(x,eta)
title('Compressor curve','Interpreter','latex')
xlabel('$P_{out}/P_{in}$','Interpreter','latex')
ylabel('$\eta$','Interpreter','latex')
legend('Regression', 'Points')


