![Screen Shot 2018-12-08 at 3.32.28 PM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/198550/Screen%20Shot%202018-12-08%20at%203.32.28%20PM.png)
i am designing a 500m pipeline, but i'm facing a problem with my code, it can't seem to plot a graph. i know it's a bit long but this is the only way to post the question. i have a lot of columns due to the range of velocities used.
2 views (last 30 days)
Show older comments
omar mahallawy
on 8 Dec 2018
Commented: omar mahallawy
on 8 Dec 2018
clear,clc,clf
format long
Q=0.03;
rouh=847;
g=9.81;
Gamma=(rouh.*g);
Zs=0;
Ze=0;
L=500;
Ks=(6*10.^-5);
viscosity=(1.1*10.^-6);
V=1.34:0.5:4.5;
for I=1
D=sqrt(((4.*Q))./(V.*pi))
end
Re=(V.*D./viscosity);
Er=(1.*10.^-8);
Fo=0.01;
for I=0:1:10^6;
Fn=(1./(-4.*log10((Ks./(3.71.*D))+((1.26)./(Re.*sqrt(Fo)))))).^2;
E=abs((Fn-Fo)/Fn);
if E<=Er;
display(Fn),display(E),break,
end
if E>Er;
Fo=Fn;
end
end
Hloss=((Fn.*L.*Q.^2)./(12.*D.^5))
Hpump=Hloss
%calculating Hloss every 100M
for HLC=1:100:500
display(HLC)
r0=HLC
HlossN=((Fn.*HLC.*Q.^2)./(12.*D.^5))
TEL=(Hpump-HlossN+Zs)
r1 = TEL(:,1)
HGL=(TEL-((V.^2)./2.*g))
r2 = HGL(:,1)
plot(r0,r1)
hold on
plot(r0,r2)
end
0 Comments
Accepted Answer
madhan ravi
on 8 Dec 2018
Edited: madhan ravi
on 8 Dec 2018
clear,clc,clf
format long
Q=0.03;
rouh=847;
g=9.81;
Gamma=(rouh.*g);
Zs=0;
Ze=0;
L=500;
Ks=(6*10.^-5);
viscosity=(1.1*10.^-6);
V=1.34:0.5:4.5;
for I=1
D=sqrt(((4.*Q))./(V.*pi))
end
Re=(V.*D./viscosity);
Er=(1.*10.^-8);
Fo=0.01;
for I=0:1:10^6;
Fn=(1./(-4.*log10((Ks./(3.71.*D))+((1.26)./(Re.*sqrt(Fo)))))).^2;
E=abs((Fn-Fo)/Fn);
if E<=Er;
display(Fn),display(E),break,
end
if E>Er;
Fo=Fn;
end
end
Hloss=((Fn.*L.*Q.^2)./(12.*D.^5))
Hpump=Hloss
%calculating Hloss every 83.33M
HLC=linspace(0,500,7);
r0=HLC;
HlossN=((Fn.*HLC.*Q.^2)./(12.*D.^5));
TEL=(Hpump-HlossN+Zs);
r1 = TEL;
HGL=(TEL-((V.^2)./2.*g));
r2 = HGL;
plot(r0,r1,'-ok')
hold on
plot(r0,r2,'-om')
![Screen Shot 2018-12-08 at 3.32.28 PM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/198550/Screen%20Shot%202018-12-08%20at%203.32.28%20PM.png)
More Answers (0)
See Also
Categories
Find more on Waveform Generation 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!