shouldn't there be two parallel lines on my plot?

clear,clc,clf
format long
Q=3.3;
%gamma=8.43 kN/m3 = 859.62076503 Kg/m3 (*1000/9.81)
rouh=859.62076503;
g=9.81;
Gamma=(rouh.*g);
Zs=0;
Ze=0;
L=1285000;
Ks=(0.000045);
Er=(1.*10.^-8);
viscosity=(3.83.*10.^-3);
% material grade X70
strength= 482000000;
%API 5L
Do=[1.016 1.06682 1.1176 1.1684 1.2192]
V=((4.*Q)./(pi.*Do.^2))
Re=(V.*Do./viscosity)
Fo=0.01;
for I=0:1:10^6;
Fn=(1./(-4.*log10((Ks./(3.71.*Do))+((1.26)./(Re.*sqrt(Fo)))))).^2;
E=abs((Fn-Fo)/Fn);
if E<=Er;
Fn=Fn(end),display(E),break,
end
if E>Er;
Fo=Fn;
end
end
Hloss=((Fn.*L.*Q.^2)./(12.*Do.^5))
Hpump=Hloss+Ze-Zs
%calculating Hloss every 100000M
HLC=1:128500:1285000;
for i=1:1:length(HLC);
HlossN=((Fn.*HLC(i).*Q.^2)./(12.*Do.^5))
TEL(i,:)=(Hpump-HlossN+Zs)
HGL(i,:)=(TEL(i,:)-((V.^2)./(2.*g)))
Pe=Gamma.*(HGL-Ze);
T=((Pe(i).*Do)./(2.*strength))
end
for ii=1:1:length(Do)
subplot(3,3,ii),
plot(HLC,TEL(:,ii),HLC,HGL(:,ii))
xlabel('HLC')
ylabel('HGL & TEL')
end

 Accepted Answer

There actually are two parallel lines, but you need to zoom in quite a lot.
If you have a look at the output of the line below, you'll notice that there is not even a percent difference between the two.
TEL(:,ii)./HGL(:,ii)

1 Comment

i feel so stupid right now!
gosh, thank you soo much
life saver!

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!