# Is there a way to find the x & y intercepts and give it a label?

13 views (last 30 days)
Tyler Russell on 20 Oct 2022
Edited: Chris on 20 Oct 2022
This is not the entire code but enough to help with the question.
%Pump System closed and/ or open Design
clc;clear;
Q = (0:100:1000);
%constants
y2 = 2.040816*10^(-4) * Q.^2; %11 points in psi
ro = 1.94; % slug/ft^3
g = 32.2; % ft/s^2
V_o = 15; % ft/s
pi = 3.14159; %
%H_ts= Head loss over the test section
H_ts = (y2*144)/(ro*g);% test section in ft
%Diameter size
Q_o = 1.56 ; % 700 Gal/min
%Crane Manual Info Given:
NPS = 5; %in
OD = 5.31 ; %in
ID = 5.047; %in
D_ft = ID/12; % ft
Roughness = 0.00015;
Relative_roughness = Roughness/(ID); % both in ins
Friction_factor_steel_pipe = 0.016; %
Red_num = 4*10^6; %
% New Velocity Using the info from above
%V_new = (4*Q_o)/(pi*(D_ft)^2);
% using this calcuation:
V_new = 11.2065; % make into an array
Q_Conv = (35.5/(264*60))*Q; % units are in ft^3/s
% from this we see that V_new is less that V_o so it can be used
%11 points
Length_Pipe_closed = 75.42; %ft
Length_Pipe_open = 92.9;% ft
K_Total_Closed_pipe_fittings = 2.14 ; %2.14
K_Total_open_fittings = 3.12;
C_closed = (((Friction_factor_steel_pipe*Length_Pipe_closed)/D_ft)+ K_Total_Closed_pipe_fittings)/(2*g)
C_open = (((Friction_factor_steel_pipe*Length_Pipe_open)/D_ft)+ K_Total_open_fittings)/(2*g)
H_closed_pipe = C_closed*(Q_Conv.^2); %ft^2
H_open_pipe = C_open*(Q_Conv.^2);
H_system_closed = H_ts + H_closed_pipe
H_system_Open = H_ts + H_open_pipe
Stand_pipe_lenght = 14 ; % ft
%NPSHa_closed = 403 % from pump info total head at op point needs to be
%over the head loss and NPSHr at any flow rate. :3
%NPSHa_open = (12.5*144)/(62.4) - (2.89*144)/(62.4) + Stand_pipe_lenght
%Graphs%
% y = (2.040816*10.^(-4*x)).^2 ---- IF YOU CHECK YOUR MATRIX, ONLY 1ST VALUE IS
% NON-ZERO
% dh_closed = 0;
% dh_open = 13.1; %ft
% k = 0 ;
% hl = k*Q.^2;
% H_closed= dh_closed + hl;
% H_open = dh_open + hl;
pump_curve = [350, 350, 350 350, 350, 350, 330, 325, 320, 290, 240];
% Closed_system_curve = H_closed+ y2;
% Open_system_curve = H_open +y2;
% hold on
% %plot(x)
hold on
plot(Q , H_system_Open)
plot (Q, pump_curve )
title('Pump curve vs system curve')
xlabel ('Flow Rate Q in gal/ min')
hold on
xinter = 815;
yinter = 315;
hold on
plot(xinter,yinter,'k*') % plots a * in black
hold off
dpb on 20 Oct 2022
Edited: dpb on 20 Oct 2022
"...not the entire code but enough to help with the question."
And the specific Q? is????

Chris on 20 Oct 2022
Edited: Chris on 20 Oct 2022
[~, idx] = min(abs(H_system_Open-pump_curve));
plot(Q(idx), pump_curve(idx),'k*')
text(Q(idx),pump_curve(idx),'Label')
If you want better resolution, include more points in Q.
Alternatively, You could use a function handle with fzero to more precisely find the x-intercept of the difference between the curves.

### Categories

Find more on Graphics in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by