d = 0.2:0.1:1.5;

v2 = (3724./(1 - 0.0001 ./ (d.^4))).^0.5;
v1 = (0.01 ./(d.^2)) .* v2;
Q = (pi./4).*0.01.*v2;
hf = (0.576.*v1.^(1.75) ).*d.^(-1.25);
mdot = 1000.*Q;
P = 2.*(31.4.*v2 -31.4^2 ).*mdot;
Pmax = (v2.^2).*mdot./2;
Omax = v2./2;

p1 = figure();
hold on;
title('Velocity of Nozzle Varying Diameter of Penstock');
plot(d,v2);
hold off;
%close(p1);

p2 = figure();
hold on;
title('Flow Rate');
plot(d,Q);
hold off;
%close(p2);

p3 = figure();
hold on;
title ('Friction Head');
plot(d,hf);
hold off;
%close(p3);

p4 = figure();
hold on;
title ('Power at 31.4 rad/s');
plot(d,P);
hold off;
%close(p4);

p5 = figure();
hold on;
title ('Max Power');
plot(d,Pmax);
hold off;
%close(p5);

p6 = figure();
hold on;
title ('Max Omega');
plot(d,Omax);
hold off;
%close(p6);
