%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%               Pumpe
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Manual script for:
% 1) plots pump characteristics
% 2) finds related flow to the given pressure 
%    difference dp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dp=15;
% P_pump=[13.2 12.1 10.8 9.2 7.2];
% V_dot=[1000 1300 1650 1774 1876];
 P_pump=[14.3 14 13.2 12.1 10.8 9.2 7.2 4 0];
 V_dot=[0 500 1000 1300 1650 1774 1876 1980 2000];
polyn = polyfit(P_pump,V_dot,5);
n=length(polyn);
flow=polyn(1,1)*dp^(n-1)+polyn(1,2)*dp^(n-2)+...
    polyn(1,3)*dp^(n-3)+polyn(1,4)*dp^(n-4)+...
    polyn(1,5)*dp^(n-5)+polyn(1,6);
%pressure=pressure*10^5;
f = polyval(polyn,P_pump);
plot(P_pump,V_dot,'o',P_pump,f,'--')
axis([0 17 0 2300]);
grid on;
hold on;
