Please assist to resolve a updated requirement in multi-variables (inbuilt for function); it only undergo once update among the ten expected outputs, see line 7 and 60
1 view (last 30 days)
Show older comments
The SANAI2 function need only (Qy0(1:34,1) input and D (to be updated accordingly as for function) and L (non updated). The Output be in DD (table) to assist observation analytical results etc. However all variables of DD in rows not changing as my expectation as 1st row to 10th row, seen executed output tables and other relevant information, below; included not solution not found (10 times). Please assist to resolve the code problem. Thanks once again.
FUNCTION AND FOR ... WITH D=[ ] ....
function [Qy, DD, FUN] = SANAI2(Qy0)
tic, % matL=abs(matr); [NodLp,pQ]=size(matr);
NodLp=41; LP=5; data1=4; pQ=35; data2=data1+1+1; Nod3=NodLp-data1-LP; p=pQ-1; JJ=data1+Nod3+1; HLD=0;
ee=0.04; vs=1.00001*10^-6; %format shortEng, % L=matr(1,1:end-1); D=matr(2,1:end-1);
D=[]; DD=zeros(10,p); %
for n=1:10
L = [100 1350 900 1150 1450 450 850 850 800 950 1200 3500 800 500 550 2730 1750 800 400 2200 1500 500 2650 1230 1300 850 300 750 1500 2000 1600 150 860 950];
D = [0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610
];
Dia = [0.305 0.406 0.508 0.609 0.762 1.016 1.905]; szDia=size(Dia,2);
% Qy0(1:34,1)=5.53;
FUN=@(Qy)[(1.*Qy(3).*abs(Qy(3)*8.*L(1,3)*1./(9.81*3.14.^2.*D(1,3).^5).*(0.25.*(log10(ee./(3.7.*D(1,3))+2.51*3.14*vs.*D(1,3)./(4.*Qy(3)).*(0.25.*(log10(ee./(3.7.*D(1,3))+2.51*3.14*vs.*D(1,3)./(4.*Qy(3)).*(0.25.*(log10(ee./(3.7.*D(1,3))+2.51*3.14*vs.*D(1,3)./(4.*Qy(3)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(4).*abs(Qy(4)*8.*L(1,4)*1./(9.81*3.14.^2.*D(1,4).^5).*(0.25.*(log10(ee./(3.7.*D(1,4))+2.51*3.14*vs.*D(1,4)./(4.*Qy(4)).*(0.25.*(log10(ee./(3.7.*D(1,4))+2.51*3.14*vs.*D(1,4)./(4.*Qy(4)).*(0.25.*(log10(ee./(3.7.*D(1,4))+2.51*3.14*vs.*D(1,4)./(4.*Qy(4)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(5).*abs(Qy(5)*8.*L(1,5)*1./(9.81*3.14.^2.*D(1,5).^5).*(0.25.*(log10(ee./(3.7.*D(1,5))+2.51*3.14*vs.*D(1,5)./(4.*Qy(5)).*(0.25.*(log10(ee./(3.7.*D(1,5))+2.51*3.14*vs.*D(1,5)./(4.*Qy(5)).*(0.25.*(log10(ee./(3.7.*D(1,5))+2.51*3.14*vs.*D(1,5)./(4.*Qy(5)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(6).*abs(Qy(6)*8.*L(1,6)*1./(9.81*3.14.^2.*D(1,6).^5).*(0.25.*(log10(ee./(3.7.*D(1,6))+2.51*3.14*vs.*D(1,6)./(4.*Qy(6)).*(0.25.*(log10(ee./(3.7.*D(1,6))+2.51*3.14*vs.*D(1,6)./(4.*Qy(6)).*(0.25.*(log10(ee./(3.7.*D(1,6))+2.51*3.14*vs.*D(1,6)./(4.*Qy(6)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(7).*abs(Qy(7)*8.*L(1,7)*1./(9.81*3.14.^2.*D(1,7).^5).*(0.25.*(log10(ee./(3.7.*D(1,7))+2.51*3.14*vs.*D(1,7)./(4.*Qy(7)).*(0.25.*(log10(ee./(3.7.*D(1,7))+2.51*3.14*vs.*D(1,7)./(4.*Qy(7)).*(0.25.*(log10(ee./(3.7.*D(1,7))+2.51*3.14*vs.*D(1,7)./(4.*Qy(7)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(8).*abs(Qy(8)*8.*L(1,8)*1./(9.81*3.14.^2.*D(1,8).^5).*(0.25.*(log10(ee./(3.7.*D(1,8))+2.51*3.14*vs.*D(1,8)./(4.*Qy(8)).*(0.25.*(log10(ee./(3.7.*D(1,8))+2.51*3.14*vs.*D(1,8)./(4.*Qy(8)).*(0.25.*(log10(ee./(3.7.*D(1,8))+2.51*3.14*vs.*D(1,8)./(4.*Qy(8)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(9).*abs(Qy(9)*8.*L(1,9)*1./(9.81*3.14.^2.*D(1,9).^5).*(0.25.*(log10(ee./(3.7.*D(1,9))+2.51*3.14*vs.*D(1,9)./(4.*Qy(9)).*(0.25.*(log10(ee./(3.7.*D(1,9))+2.51*3.14*vs.*D(1,9)./(4.*Qy(9)).*(0.25.*(log10(ee./(3.7.*D(1,9))+2.51*3.14*vs.*D(1,9)./(4.*Qy(9)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(13).*abs(Qy(13)*8.*L(1,13)*1./(9.81*3.14.^2.*D(1,13).^5).*(0.25.*(log10(ee./(3.7.*D(1,13))+2.51*3.14*vs.*D(1,13)./(4.*Qy(13)).*(0.25.*(log10(ee./(3.7.*D(1,13))+2.51*3.14*vs.*D(1,13)./(4.*Qy(13)).*(0.25.*(log10(ee./(3.7.*D(1,13))+2.51*3.14*vs.*D(1,13)./(4.*Qy(13)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(14).*abs(Qy(14)*8.*L(1,14)*1./(9.81*3.14.^2.*D(1,14).^5).*(0.25.*(log10(ee./(3.7.*D(1,14))+2.51*3.14*vs.*D(1,14)./(4.*Qy(14)).*(0.25.*(log10(ee./(3.7.*D(1,14))+2.51*3.14*vs.*D(1,14)./(4.*Qy(14)).*(0.25.*(log10(ee./(3.7.*D(1,14))+2.51*3.14*vs.*D(1,14)./(4.*Qy(14)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(15).*abs(Qy(15)*8.*L(1,15)*1./(9.81*3.14.^2.*D(1,15).^5).*(0.25.*(log10(ee./(3.7.*D(1,15))+2.51*3.14*vs.*D(1,15)./(4.*Qy(15)).*(0.25.*(log10(ee./(3.7.*D(1,15))+2.51*3.14*vs.*D(1,15)./(4.*Qy(15)).*(0.25.*(log10(ee./(3.7.*D(1,15))+2.51*3.14*vs.*D(1,15)./(4.*Qy(15)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(16).*abs(Qy(16)*8.*L(1,16)*1./(9.81*3.14.^2.*D(1,16).^5).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(17).*abs(Qy(17)*8.*L(1,17)*1./(9.81*3.14.^2.*D(1,17).^5).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(18).*abs(Qy(18)*8.*L(1,18)*1./(9.81*3.14.^2.*D(1,18).^5).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(19).*abs(Qy(19)*8.*L(1,19)*1./(9.81*3.14.^2.*D(1,19).^5).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(0);...
(1.*Qy(16).*abs(Qy(16)*8.*L(1,16)*1./(9.81*3.14.^2.*D(1,16).^5).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(17).*abs(Qy(17)*8.*L(1,17)*1./(9.81*3.14.^2.*D(1,17).^5).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(18).*abs(Qy(18)*8.*L(1,18)*1./(9.81*3.14.^2.*D(1,18).^5).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(19).*abs(Qy(19)*8.*L(1,19)*1./(9.81*3.14.^2.*D(1,19).^5).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(20).*abs(Qy(20)*8.*L(1,20)*1./(9.81*3.14.^2.*D(1,20).^5).*(0.25.*(log10(ee./(3.7.*D(1,20))+2.51*3.14*vs.*D(1,20)./(4.*Qy(20)).*(0.25.*(log10(ee./(3.7.*D(1,20))+2.51*3.14*vs.*D(1,20)./(4.*Qy(20)).*(0.25.*(log10(ee./(3.7.*D(1,20))+2.51*3.14*vs.*D(1,20)./(4.*Qy(20)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(23).*abs(Qy(23)*8.*L(1,23)*1./(9.81*3.14.^2.*D(1,23).^5).*(0.25.*(log10(ee./(3.7.*D(1,23))+2.51*3.14*vs.*D(1,23)./(4.*Qy(23)).*(0.25.*(log10(ee./(3.7.*D(1,23))+2.51*3.14*vs.*D(1,23)./(4.*Qy(23)).*(0.25.*(log10(ee./(3.7.*D(1,23))+2.51*3.14*vs.*D(1,23)./(4.*Qy(23)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(24).*abs(Qy(24)*8.*L(1,24)*1./(9.81*3.14.^2.*D(1,24).^5).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(25).*abs(Qy(25)*8.*L(1,25)*1./(9.81*3.14.^2.*D(1,25).^5).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(26).*abs(Qy(26)*8.*L(1,26)*1./(9.81*3.14.^2.*D(1,26).^5).*(0.25.*(log10(ee./(3.7.*D(1,26))+2.51*3.14*vs.*D(1,26)./(4.*Qy(26)).*(0.25.*(log10(ee./(3.7.*D(1,26))+2.51*3.14*vs.*D(1,26)./(4.*Qy(26)).*(0.25.*(log10(ee./(3.7.*D(1,26))+2.51*3.14*vs.*D(1,26)./(4.*Qy(26)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(27).*abs(Qy(27)*8.*L(1,27)*1./(9.81*3.14.^2.*D(1,27).^5).*(0.25.*(log10(ee./(3.7.*D(1,27))+2.51*3.14*vs.*D(1,27)./(4.*Qy(27)).*(0.25.*(log10(ee./(3.7.*D(1,27))+2.51*3.14*vs.*D(1,27)./(4.*Qy(27)).*(0.25.*(log10(ee./(3.7.*D(1,27))+2.51*3.14*vs.*D(1,27)./(4.*Qy(27)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(28).*abs(Qy(28)*8.*L(1,28)*1./(9.81*3.14.^2.*D(1,28).^5).*(0.25.*(log10(ee./(3.7.*D(1,28))+2.51*3.14*vs.*D(1,28)./(4.*Qy(28)).*(0.25.*(log10(ee./(3.7.*D(1,28))+2.51*3.14*vs.*D(1,28)./(4.*Qy(28)).*(0.25.*(log10(ee./(3.7.*D(1,28))+2.51*3.14*vs.*D(1,28)./(4.*Qy(28)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(0);...
(1.*Qy(24).*abs(Qy(24)*8.*L(1,24)*1./(9.81*3.14.^2.*D(1,24).^5).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(25).*abs(Qy(25)*8.*L(1,25)*1./(9.81*3.14.^2.*D(1,25).^5).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(29).*abs(Qy(29)*8.*L(1,29)*1./(9.81*3.14.^2.*D(1,29).^5).*(0.25.*(log10(ee./(3.7.*D(1,29))+2.51*3.14*vs.*D(1,29)./(4.*Qy(29)).*(0.25.*(log10(ee./(3.7.*D(1,29))+2.51*3.14*vs.*D(1,29)./(4.*Qy(29)).*(0.25.*(log10(ee./(3.7.*D(1,29))+2.51*3.14*vs.*D(1,29)./(4.*Qy(29)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(30).*abs(Qy(30)*8.*L(1,30)*1./(9.81*3.14.^2.*D(1,30).^5).*(0.25.*(log10(ee./(3.7.*D(1,30))+2.51*3.14*vs.*D(1,30)./(4.*Qy(30)).*(0.25.*(log10(ee./(3.7.*D(1,30))+2.51*3.14*vs.*D(1,30)./(4.*Qy(30)).*(0.25.*(log10(ee./(3.7.*D(1,30))+2.51*3.14*vs.*D(1,30)./(4.*Qy(30)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(31).*abs(Qy(31)*8.*L(1,31)*1./(9.81*3.14.^2.*D(1,31).^5).*(0.25.*(log10(ee./(3.7.*D(1,31))+2.51*3.14*vs.*D(1,31)./(4.*Qy(31)).*(0.25.*(log10(ee./(3.7.*D(1,31))+2.51*3.14*vs.*D(1,31)./(4.*Qy(31)).*(0.25.*(log10(ee./(3.7.*D(1,31))+2.51*3.14*vs.*D(1,31)./(4.*Qy(31)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(32).*abs(Qy(32)*8.*L(1,32)*1./(9.81*3.14.^2.*D(1,32).^5).*(0.25.*(log10(ee./(3.7.*D(1,32))+2.51*3.14*vs.*D(1,32)./(4.*Qy(32)).*(0.25.*(log10(ee./(3.7.*D(1,32))+2.51*3.14*vs.*D(1,32)./(4.*Qy(32)).*(0.25.*(log10(ee./(3.7.*D(1,32))+2.51*3.14*vs.*D(1,32)./(4.*Qy(32)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(33).*abs(Qy(33)*8.*L(1,33)*1./(9.81*3.14.^2.*D(1,33).^5).*(0.25.*(log10(ee./(3.7.*D(1,33))+2.51*3.14*vs.*D(1,33)./(4.*Qy(33)).*(0.25.*(log10(ee./(3.7.*D(1,33))+2.51*3.14*vs.*D(1,33)./(4.*Qy(33)).*(0.25.*(log10(ee./(3.7.*D(1,33))+2.51*3.14*vs.*D(1,33)./(4.*Qy(33)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(34).*abs(Qy(34)*8.*L(1,34)*1./(9.81*3.14.^2.*D(1,34).^5).*(0.25.*(log10(ee./(3.7.*D(1,34))+2.51*3.14*vs.*D(1,34)./(4.*Qy(34)).*(0.25.*(log10(ee./(3.7.*D(1,34))+2.51*3.14*vs.*D(1,34)./(4.*Qy(34)).*(0.25.*(log10(ee./(3.7.*D(1,34))+2.51*3.14*vs.*D(1,34)./(4.*Qy(34)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(0);...
(1.*Qy(1).*abs(Qy(1)*8.*L(1,1)*1./(9.81*3.14.^2.*D(1,1).^5).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(10).*abs(Qy(10)*8.*L(1,10)*1./(9.81*3.14.^2.*D(1,10).^5).*(0.25.*(log10(ee./(3.7.*D(1,10))+2.51*3.14*vs.*D(1,10)./(4.*Qy(10)).*(0.25.*(log10(ee./(3.7.*D(1,10))+2.51*3.14*vs.*D(1,10)./(4.*Qy(10)).*(0.25.*(log10(ee./(3.7.*D(1,10))+2.51*3.14*vs.*D(1,10)./(4.*Qy(10)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(11).*abs(Qy(11)*8.*L(1,11)*1./(9.81*3.14.^2.*D(1,11).^5).*(0.25.*(log10(ee./(3.7.*D(1,11))+2.51*3.14*vs.*D(1,11)./(4.*Qy(11)).*(0.25.*(log10(ee./(3.7.*D(1,11))+2.51*3.14*vs.*D(1,11)./(4.*Qy(11)).*(0.25.*(log10(ee./(3.7.*D(1,11))+2.51*3.14*vs.*D(1,11)./(4.*Qy(11)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(12).*abs(Qy(12)*8.*L(1,12)*1./(9.81*3.14.^2.*D(1,12).^5).*(0.25.*(log10(ee./(3.7.*D(1,12))+2.51*3.14*vs.*D(1,12)./(4.*Qy(12)).*(0.25.*(log10(ee./(3.7.*D(1,12))+2.51*3.14*vs.*D(1,12)./(4.*Qy(12)).*(0.25.*(log10(ee./(3.7.*D(1,12))+2.51*3.14*vs.*D(1,12)./(4.*Qy(12)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-4);...
(1.*Qy(1).*abs(Qy(1)*8.*L(1,1)*1./(9.81*3.14.^2.*D(1,1).^5).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(21).*abs(Qy(21)*8.*L(1,21)*1./(9.81*3.14.^2.*D(1,21).^5).*(0.25.*(log10(ee./(3.7.*D(1,21))+2.51*3.14*vs.*D(1,21)./(4.*Qy(21)).*(0.25.*(log10(ee./(3.7.*D(1,21))+2.51*3.14*vs.*D(1,21)./(4.*Qy(21)).*(0.25.*(log10(ee./(3.7.*D(1,21))+2.51*3.14*vs.*D(1,21)./(4.*Qy(21)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(22).*abs(Qy(22)*8.*L(1,22)*1./(9.81*3.14.^2.*D(1,22).^5).*(0.25.*(log10(ee./(3.7.*D(1,22))+2.51*3.14*vs.*D(1,22)./(4.*Qy(22)).*(0.25.*(log10(ee./(3.7.*D(1,22))+2.51*3.14*vs.*D(1,22)./(4.*Qy(22)).*(0.25.*(log10(ee./(3.7.*D(1,22))+2.51*3.14*vs.*D(1,22)./(4.*Qy(22)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-4);...
(1.*Qy(1))+(-1.*Qy(2))+(-2.472000e-01);...
(1.*Qy(2))+(-1.*Qy(3))+(-1.*Qy(19))+(-1.*Qy(20))+(-2.361000e-01);...
(1.*Qy(3))+(-1.*Qy(4))+(-3.610000e-02);...
(1.*Qy(4))+(-1.*Qy(5))+(-2.014000e-01);...
(1.*Qy(5))+(-1.*Qy(6))+(-2.792000e-01);...
(1.*Qy(6))+(-1.*Qy(7))+(-3.750000e-01);...
(1.*Qy(7))+(-1.*Qy(8))+(-1.528000e-01);...
(1.*Qy(8))+(-1.*Qy(9))+(-1.458000e-01);...
(1.*Qy(9))+(-1.*Qy(10))+(1.*Qy(13))+(-1.458000e-01);...
(1.*Qy(10))+(-1.*Qy(11))+(-1.389000e-01);...
(1.*Qy(11))+(-1.*Qy(12))+(-1.556000e-01);...
(1.*Qy(12))+(-2.611000e-01);...
(-1.*Qy(13))+(1.*Qy(14))+(-1.708000e-01);...
(-1.*Qy(14))+(1.*Qy(15))+(-7.780000e-02);...
(-1.*Qy(15))+(1.*Qy(16))+(-1.*Qy(28))+(-8.610000e-02);...
(-1.*Qy(16))+(1.*Qy(17))+(-2.403000e-01);...
(-1.*Qy(17))+(1.*Qy(18))+(-3.736000e-01);...
(-1.*Qy(18))+(1.*Qy(19))+(-1.670000e-02);...
(1.*Qy(20))+(-1.*Qy(21))+(-1.*Qy(23))+(-3.542000e-01);...
(1.*Qy(21))+(-1.*Qy(22))+(-2.583000e-01);...
(1.*Qy(22))+(-1.347000e-01);...
(1.*Qy(23))+(-1.*Qy(24))+(-1.*Qy(29))+(-2.903000e-01);...
(1.*Qy(24))+(-1.*Qy(25))+(-2.278000e-01);...
(1.*Qy(25))+(1.*Qy(26))+(-4.720000e-02);...
(-1.*Qy(26))+(1.*Qy(27))+(-2.500000e-01);...
(-1.*Qy(27))+(1.*Qy(28))+(-1.028000e-01);...
(1.*Qy(29))+(-1.*Qy(30))+(-8.060000e-02);...
(1.*Qy(30))+(-1.*Qy(31))+(-1.000000e-01);...
(1.*Qy(31))+(-1.*Qy(32))+(-1.000000e-01);...
(1.*Qy(32))+(1.*Qy(33))+(-2.920000e-02);...
(-1.*Qy(33))+(1.*Qy(34))+(-2.236000e-01)];
options = optimoptions('fsolve','Display','iter',MaxIterations=100000, MaxFunctionEvaluations=100000, Algorithm='levenberg-marquardt'); % 'levenberg-marquardt'
[Qy] = fsolve(FUN, Qy0, options);
for i=1:size(D,2)
vel=abs(4*Qy(i,1)./(3.14*D(1,i).^2)); [rn, cn]=find(Dia(1,1:szDia)<D(1,i),1,'first'); [rx, cx]=find(Dia(1,1:szDia)>D(1,i),1,'first'); % vel_mn=0.5*Dia(2,i);
if isempty(rn)&&isempty(rx)
elseif vel<0.3 && ~isempty(rn); D(1,i) = Dia(1,cn);
elseif vel>2.0 && ~isempty(rx); D(1,i) = Dia(1,cx);
else (~isempty(rn)&&~isempty(rx))&&((vel<2&&vel>0.3)); end
end
DD(n,:) = D(:); D = D; %Qy=Qy,
end
DD, Li=L'; Di=D'; vel=abs(4*Qy(:,1)./(3.14.*(Di(:,1)).^2)); Re=abs(4.*Qy(:,1)./(3.14*vs.*Di(:,1)));
fy11=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)*0.0001.^0.5)); fy1=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)).*fy11.^0.5); fy=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)).*fy1.^0.5); f=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)).*fy.^0.5); ff=(1./f).^2;
n=7; Data1=zeros(p,n); Data1(:,1)=Li(:,1); Data1(:,2)=Di(:,1); Data1(:,3)=Qy(:,1); Data1(:,4)=vel(:,1); Data1(:,5)=ff(:,1); Data1(:,6)=Re(:,1); Data1(:,7)=8./(9.81*3.14.^2).*Data1(:,5).*Data1(:,1).*(Data1(:,3)).^2./(Data1(:,2)).^5;
StrNum={'string','double','double','double','double','double','double','double'}; subTitl={'Pipes [x-z]', 'Length [m]', 'Diameter [m]', 'Flow rate [m3/s]', 'Velocity [m/s]', 'Friction, f', 'Reynold No.', 'Headlosses [m]'};
tz=table('size', [p, 8], 'variabletypes',StrNum, 'variablenames', subTitl); Pipexz=["1P","2P","3P","4P","5P","6P","7P","8P","9P","10P","11P","12P","13P","14P","15P","16P","17P","18P","19P","20P","1P","2P","3P","4P","5P","6P","7P","8P","9P","10P","11P","12P","13P","14P"];
tz{:,1}=Pipexz'; tz{:,2:8} = Data1(:,1:7), toc, % tz{:,2:cCc+0} = Data1(:,1:cCc), % MIDsrt=sortrows(tz,sn); MIDfn=MIDsrt; MIDfn(:,end)=[ ];
end
EXECUTED OUTPUT
>> Qy0(1:34,1)=5.53;sanai(Qy0)
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
First-order Norm of
Iteration Func-count ||f(x)||^2 optimality Lambda step
0 35 3.52488e+08 4.33e+07 0.01
1 70 4.43873e+07 6.09e+06 0.001 23.7573
2 105 3.05072e+06 8.03e+05 0.0001 9.30781
3 140 186221 9.93e+04 1e-05 7.81348
4 175 11176.6 1.25e+04 1e-06 3.95876
5 210 843.678 1.43e+03 1e-07 1.91422
6 250 489.147 3.1e+03 0.01 2.28327
7 285 291.247 2.14e+03 0.001 0.813901
8 320 76.6649 1.29e+03 0.0001 0.712558
9 355 2.91388 144 1e-05 0.237979
10 393 2.54221 182 0.01 0.269592
11 429 1.9157 62.7 0.1 0.199454
12 465 0.581441 3.11 1 0.086335
13 500 0.537512 0.482 0.1 0.0227771
14 536 0.537034 0.307 1 0.0117352
15 571 0.536874 0.187 0.1 0.00848093
16 607 0.536791 0.0923 1 0.00591641
17 642 0.536744 0.0463 0.1 0.00465591
18 677 0.536694 0.419 0.01 0.0180623
19 714 0.536654 0.00912 1 0.0032493
20 749 0.536652 0.00243 0.1 0.00105161
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
value of the function tolerance.
<stopping criteria details>
DD =
Columns 1 through 14
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
0.7620 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100
Columns 15 through 28
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
0.6100 0.3050 0.3050 0.6100 0.6100 0.3050 0.3050 0.3050 0.6100 0.6100 0.6100 0.6100 0.6100 0.6100
Columns 29 through 34
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
0.7620 0.7620 0.7620 0.7620 0.7620 0.7620
tz =
34×8 table
Pipes [x-z] Length [m] Diameter [m] Flow rate [m3/s] Velocity [m/s] Friction, f Reynold No. Headlosses [m]
___________ __________ ____________ ________________ ______________ ___________ ___________ ______________
"1P" 100 0.762 0.69245 1.5192 0.073207 1.1576e+06 1.1301
"2P" 1350 0.61 0.56451 1.9326 0.081505 1.1789e+06 34.338
"3P" 900 0.61 0.26093 0.89329 0.081515 5.449e+05 4.8914
"4P" 1150 0.61 0.34484 1.1806 0.08151 7.2014e+05 10.916
"5P" 1450 0.61 0.26461 0.9059 0.081515 5.526e+05 8.1048
: : : : : : : :
"10P" 2000 0.762 -0.904 1.9833 0.073189 1.5113e+06 38.512
"11P" 1600 0.762 -1.0621 2.3301 0.07319 1.7755e+06 42.528
"12P" 150 0.762 -1.3096 2.8732 0.073191 2.1893e+06 6.062
"13P" 860 0.762 1.4968 3.2838 0.073201 2.5022e+06 45.405
"14P" 950 0.762 1.8107 3.9726 0.0732 3.0271e+06 73.405
Display all 34 rows.
Elapsed time is 0.854046 seconds.
ans =
0.6924
0.5645
0.2609
0.3448
0.2646
0.1076
-0.1452
-0.1757
-0.1988
0.0163
0.0168
0.0217
0.2380
0.2849
0.2382
-0.0391
0.0768
0.3273
0.2238
-0.0371
0.0467
-0.0462
-0.3201
0.3550
0.2484
-0.3343
-0.2131
-0.2381
-0.8605
-0.9040
-1.0621
-1.3096
1.4968
1.8107
1 Comment
Alex Sha
on 15 May 2024
@Eng. FM You have 34 unknowns (Qy(1)-Qy(34)), but 36 equations, in this case, there is no exact solution usually.
Answers (1)
Eng. Fredius Magige
on 16 May 2024
Simply solved by this way ...
function [Qy, DD, FUN] = SANAI2(Qy0)
tic, % matL=abs(matr); [NodLp,pQ]=size(matr);
NodLp=41; LP=5; data1=4; pQ=35; data2=data1+1+1; Nod3=NodLp-data1-LP; p=pQ-1; JJ=data1+Nod3+1; HLD=0;
ee=0.04; vs=1.00001*10^-6; %format shortEng, % L=matr(1,1:end-1); D=matr(2,1:end-1);
D = [0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610 0.610];
DD=zeros(10,p);
for n=1:10
L = [100 1350 900 1150 1450 450 850 850 800 950 1200 3500 800 500 550 2730 1750 800 400 2200 1500 500 2650 1230 1300 850 300 750 1500 2000 1600 150 860 950];
D = D;
Dia = [0.305 0.406 0.508 0.609 0.762 1.016 1.905]; szDia=size(Dia,2);
% Qy0(1:34,1)=5.53;
FUN=@(Qy)[(1.*Qy(3).*abs(Qy(3)*8.*L(1,3)*1./(9.81*3.14.^2.*D(1,3).^5).*(0.25.*(log10(ee./(3.7.*D(1,3))+2.51*3.14*vs.*D(1,3)./(4.*Qy(3)).*(0.25.*(log10(ee./(3.7.*D(1,3))+2.51*3.14*vs.*D(1,3)./(4.*Qy(3)).*(0.25.*(log10(ee./(3.7.*D(1,3))+2.51*3.14*vs.*D(1,3)./(4.*Qy(3)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(4).*abs(Qy(4)*8.*L(1,4)*1./(9.81*3.14.^2.*D(1,4).^5).*(0.25.*(log10(ee./(3.7.*D(1,4))+2.51*3.14*vs.*D(1,4)./(4.*Qy(4)).*(0.25.*(log10(ee./(3.7.*D(1,4))+2.51*3.14*vs.*D(1,4)./(4.*Qy(4)).*(0.25.*(log10(ee./(3.7.*D(1,4))+2.51*3.14*vs.*D(1,4)./(4.*Qy(4)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(5).*abs(Qy(5)*8.*L(1,5)*1./(9.81*3.14.^2.*D(1,5).^5).*(0.25.*(log10(ee./(3.7.*D(1,5))+2.51*3.14*vs.*D(1,5)./(4.*Qy(5)).*(0.25.*(log10(ee./(3.7.*D(1,5))+2.51*3.14*vs.*D(1,5)./(4.*Qy(5)).*(0.25.*(log10(ee./(3.7.*D(1,5))+2.51*3.14*vs.*D(1,5)./(4.*Qy(5)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(6).*abs(Qy(6)*8.*L(1,6)*1./(9.81*3.14.^2.*D(1,6).^5).*(0.25.*(log10(ee./(3.7.*D(1,6))+2.51*3.14*vs.*D(1,6)./(4.*Qy(6)).*(0.25.*(log10(ee./(3.7.*D(1,6))+2.51*3.14*vs.*D(1,6)./(4.*Qy(6)).*(0.25.*(log10(ee./(3.7.*D(1,6))+2.51*3.14*vs.*D(1,6)./(4.*Qy(6)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(7).*abs(Qy(7)*8.*L(1,7)*1./(9.81*3.14.^2.*D(1,7).^5).*(0.25.*(log10(ee./(3.7.*D(1,7))+2.51*3.14*vs.*D(1,7)./(4.*Qy(7)).*(0.25.*(log10(ee./(3.7.*D(1,7))+2.51*3.14*vs.*D(1,7)./(4.*Qy(7)).*(0.25.*(log10(ee./(3.7.*D(1,7))+2.51*3.14*vs.*D(1,7)./(4.*Qy(7)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(8).*abs(Qy(8)*8.*L(1,8)*1./(9.81*3.14.^2.*D(1,8).^5).*(0.25.*(log10(ee./(3.7.*D(1,8))+2.51*3.14*vs.*D(1,8)./(4.*Qy(8)).*(0.25.*(log10(ee./(3.7.*D(1,8))+2.51*3.14*vs.*D(1,8)./(4.*Qy(8)).*(0.25.*(log10(ee./(3.7.*D(1,8))+2.51*3.14*vs.*D(1,8)./(4.*Qy(8)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(9).*abs(Qy(9)*8.*L(1,9)*1./(9.81*3.14.^2.*D(1,9).^5).*(0.25.*(log10(ee./(3.7.*D(1,9))+2.51*3.14*vs.*D(1,9)./(4.*Qy(9)).*(0.25.*(log10(ee./(3.7.*D(1,9))+2.51*3.14*vs.*D(1,9)./(4.*Qy(9)).*(0.25.*(log10(ee./(3.7.*D(1,9))+2.51*3.14*vs.*D(1,9)./(4.*Qy(9)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(13).*abs(Qy(13)*8.*L(1,13)*1./(9.81*3.14.^2.*D(1,13).^5).*(0.25.*(log10(ee./(3.7.*D(1,13))+2.51*3.14*vs.*D(1,13)./(4.*Qy(13)).*(0.25.*(log10(ee./(3.7.*D(1,13))+2.51*3.14*vs.*D(1,13)./(4.*Qy(13)).*(0.25.*(log10(ee./(3.7.*D(1,13))+2.51*3.14*vs.*D(1,13)./(4.*Qy(13)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(14).*abs(Qy(14)*8.*L(1,14)*1./(9.81*3.14.^2.*D(1,14).^5).*(0.25.*(log10(ee./(3.7.*D(1,14))+2.51*3.14*vs.*D(1,14)./(4.*Qy(14)).*(0.25.*(log10(ee./(3.7.*D(1,14))+2.51*3.14*vs.*D(1,14)./(4.*Qy(14)).*(0.25.*(log10(ee./(3.7.*D(1,14))+2.51*3.14*vs.*D(1,14)./(4.*Qy(14)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(15).*abs(Qy(15)*8.*L(1,15)*1./(9.81*3.14.^2.*D(1,15).^5).*(0.25.*(log10(ee./(3.7.*D(1,15))+2.51*3.14*vs.*D(1,15)./(4.*Qy(15)).*(0.25.*(log10(ee./(3.7.*D(1,15))+2.51*3.14*vs.*D(1,15)./(4.*Qy(15)).*(0.25.*(log10(ee./(3.7.*D(1,15))+2.51*3.14*vs.*D(1,15)./(4.*Qy(15)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(16).*abs(Qy(16)*8.*L(1,16)*1./(9.81*3.14.^2.*D(1,16).^5).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(17).*abs(Qy(17)*8.*L(1,17)*1./(9.81*3.14.^2.*D(1,17).^5).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(18).*abs(Qy(18)*8.*L(1,18)*1./(9.81*3.14.^2.*D(1,18).^5).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(19).*abs(Qy(19)*8.*L(1,19)*1./(9.81*3.14.^2.*D(1,19).^5).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(0);...
(1.*Qy(16).*abs(Qy(16)*8.*L(1,16)*1./(9.81*3.14.^2.*D(1,16).^5).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*(0.25.*(log10(ee./(3.7.*D(1,16))+2.51*3.14*vs.*D(1,16)./(4.*Qy(16)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(17).*abs(Qy(17)*8.*L(1,17)*1./(9.81*3.14.^2.*D(1,17).^5).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*(0.25.*(log10(ee./(3.7.*D(1,17))+2.51*3.14*vs.*D(1,17)./(4.*Qy(17)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(18).*abs(Qy(18)*8.*L(1,18)*1./(9.81*3.14.^2.*D(1,18).^5).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*(0.25.*(log10(ee./(3.7.*D(1,18))+2.51*3.14*vs.*D(1,18)./(4.*Qy(18)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(19).*abs(Qy(19)*8.*L(1,19)*1./(9.81*3.14.^2.*D(1,19).^5).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*(0.25.*(log10(ee./(3.7.*D(1,19))+2.51*3.14*vs.*D(1,19)./(4.*Qy(19)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(20).*abs(Qy(20)*8.*L(1,20)*1./(9.81*3.14.^2.*D(1,20).^5).*(0.25.*(log10(ee./(3.7.*D(1,20))+2.51*3.14*vs.*D(1,20)./(4.*Qy(20)).*(0.25.*(log10(ee./(3.7.*D(1,20))+2.51*3.14*vs.*D(1,20)./(4.*Qy(20)).*(0.25.*(log10(ee./(3.7.*D(1,20))+2.51*3.14*vs.*D(1,20)./(4.*Qy(20)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(23).*abs(Qy(23)*8.*L(1,23)*1./(9.81*3.14.^2.*D(1,23).^5).*(0.25.*(log10(ee./(3.7.*D(1,23))+2.51*3.14*vs.*D(1,23)./(4.*Qy(23)).*(0.25.*(log10(ee./(3.7.*D(1,23))+2.51*3.14*vs.*D(1,23)./(4.*Qy(23)).*(0.25.*(log10(ee./(3.7.*D(1,23))+2.51*3.14*vs.*D(1,23)./(4.*Qy(23)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(24).*abs(Qy(24)*8.*L(1,24)*1./(9.81*3.14.^2.*D(1,24).^5).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(25).*abs(Qy(25)*8.*L(1,25)*1./(9.81*3.14.^2.*D(1,25).^5).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(26).*abs(Qy(26)*8.*L(1,26)*1./(9.81*3.14.^2.*D(1,26).^5).*(0.25.*(log10(ee./(3.7.*D(1,26))+2.51*3.14*vs.*D(1,26)./(4.*Qy(26)).*(0.25.*(log10(ee./(3.7.*D(1,26))+2.51*3.14*vs.*D(1,26)./(4.*Qy(26)).*(0.25.*(log10(ee./(3.7.*D(1,26))+2.51*3.14*vs.*D(1,26)./(4.*Qy(26)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(27).*abs(Qy(27)*8.*L(1,27)*1./(9.81*3.14.^2.*D(1,27).^5).*(0.25.*(log10(ee./(3.7.*D(1,27))+2.51*3.14*vs.*D(1,27)./(4.*Qy(27)).*(0.25.*(log10(ee./(3.7.*D(1,27))+2.51*3.14*vs.*D(1,27)./(4.*Qy(27)).*(0.25.*(log10(ee./(3.7.*D(1,27))+2.51*3.14*vs.*D(1,27)./(4.*Qy(27)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(28).*abs(Qy(28)*8.*L(1,28)*1./(9.81*3.14.^2.*D(1,28).^5).*(0.25.*(log10(ee./(3.7.*D(1,28))+2.51*3.14*vs.*D(1,28)./(4.*Qy(28)).*(0.25.*(log10(ee./(3.7.*D(1,28))+2.51*3.14*vs.*D(1,28)./(4.*Qy(28)).*(0.25.*(log10(ee./(3.7.*D(1,28))+2.51*3.14*vs.*D(1,28)./(4.*Qy(28)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(0);...
(1.*Qy(24).*abs(Qy(24)*8.*L(1,24)*1./(9.81*3.14.^2.*D(1,24).^5).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*(0.25.*(log10(ee./(3.7.*D(1,24))+2.51*3.14*vs.*D(1,24)./(4.*Qy(24)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(25).*abs(Qy(25)*8.*L(1,25)*1./(9.81*3.14.^2.*D(1,25).^5).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*(0.25.*(log10(ee./(3.7.*D(1,25))+2.51*3.14*vs.*D(1,25)./(4.*Qy(25)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(29).*abs(Qy(29)*8.*L(1,29)*1./(9.81*3.14.^2.*D(1,29).^5).*(0.25.*(log10(ee./(3.7.*D(1,29))+2.51*3.14*vs.*D(1,29)./(4.*Qy(29)).*(0.25.*(log10(ee./(3.7.*D(1,29))+2.51*3.14*vs.*D(1,29)./(4.*Qy(29)).*(0.25.*(log10(ee./(3.7.*D(1,29))+2.51*3.14*vs.*D(1,29)./(4.*Qy(29)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(30).*abs(Qy(30)*8.*L(1,30)*1./(9.81*3.14.^2.*D(1,30).^5).*(0.25.*(log10(ee./(3.7.*D(1,30))+2.51*3.14*vs.*D(1,30)./(4.*Qy(30)).*(0.25.*(log10(ee./(3.7.*D(1,30))+2.51*3.14*vs.*D(1,30)./(4.*Qy(30)).*(0.25.*(log10(ee./(3.7.*D(1,30))+2.51*3.14*vs.*D(1,30)./(4.*Qy(30)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(31).*abs(Qy(31)*8.*L(1,31)*1./(9.81*3.14.^2.*D(1,31).^5).*(0.25.*(log10(ee./(3.7.*D(1,31))+2.51*3.14*vs.*D(1,31)./(4.*Qy(31)).*(0.25.*(log10(ee./(3.7.*D(1,31))+2.51*3.14*vs.*D(1,31)./(4.*Qy(31)).*(0.25.*(log10(ee./(3.7.*D(1,31))+2.51*3.14*vs.*D(1,31)./(4.*Qy(31)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(32).*abs(Qy(32)*8.*L(1,32)*1./(9.81*3.14.^2.*D(1,32).^5).*(0.25.*(log10(ee./(3.7.*D(1,32))+2.51*3.14*vs.*D(1,32)./(4.*Qy(32)).*(0.25.*(log10(ee./(3.7.*D(1,32))+2.51*3.14*vs.*D(1,32)./(4.*Qy(32)).*(0.25.*(log10(ee./(3.7.*D(1,32))+2.51*3.14*vs.*D(1,32)./(4.*Qy(32)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(33).*abs(Qy(33)*8.*L(1,33)*1./(9.81*3.14.^2.*D(1,33).^5).*(0.25.*(log10(ee./(3.7.*D(1,33))+2.51*3.14*vs.*D(1,33)./(4.*Qy(33)).*(0.25.*(log10(ee./(3.7.*D(1,33))+2.51*3.14*vs.*D(1,33)./(4.*Qy(33)).*(0.25.*(log10(ee./(3.7.*D(1,33))+2.51*3.14*vs.*D(1,33)./(4.*Qy(33)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-1.*Qy(34).*abs(Qy(34)*8.*L(1,34)*1./(9.81*3.14.^2.*D(1,34).^5).*(0.25.*(log10(ee./(3.7.*D(1,34))+2.51*3.14*vs.*D(1,34)./(4.*Qy(34)).*(0.25.*(log10(ee./(3.7.*D(1,34))+2.51*3.14*vs.*D(1,34)./(4.*Qy(34)).*(0.25.*(log10(ee./(3.7.*D(1,34))+2.51*3.14*vs.*D(1,34)./(4.*Qy(34)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(0);...
(1.*Qy(1).*abs(Qy(1)*8.*L(1,1)*1./(9.81*3.14.^2.*D(1,1).^5).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(10).*abs(Qy(10)*8.*L(1,10)*1./(9.81*3.14.^2.*D(1,10).^5).*(0.25.*(log10(ee./(3.7.*D(1,10))+2.51*3.14*vs.*D(1,10)./(4.*Qy(10)).*(0.25.*(log10(ee./(3.7.*D(1,10))+2.51*3.14*vs.*D(1,10)./(4.*Qy(10)).*(0.25.*(log10(ee./(3.7.*D(1,10))+2.51*3.14*vs.*D(1,10)./(4.*Qy(10)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(11).*abs(Qy(11)*8.*L(1,11)*1./(9.81*3.14.^2.*D(1,11).^5).*(0.25.*(log10(ee./(3.7.*D(1,11))+2.51*3.14*vs.*D(1,11)./(4.*Qy(11)).*(0.25.*(log10(ee./(3.7.*D(1,11))+2.51*3.14*vs.*D(1,11)./(4.*Qy(11)).*(0.25.*(log10(ee./(3.7.*D(1,11))+2.51*3.14*vs.*D(1,11)./(4.*Qy(11)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(12).*abs(Qy(12)*8.*L(1,12)*1./(9.81*3.14.^2.*D(1,12).^5).*(0.25.*(log10(ee./(3.7.*D(1,12))+2.51*3.14*vs.*D(1,12)./(4.*Qy(12)).*(0.25.*(log10(ee./(3.7.*D(1,12))+2.51*3.14*vs.*D(1,12)./(4.*Qy(12)).*(0.25.*(log10(ee./(3.7.*D(1,12))+2.51*3.14*vs.*D(1,12)./(4.*Qy(12)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-4);...
(1.*Qy(1).*abs(Qy(1)*8.*L(1,1)*1./(9.81*3.14.^2.*D(1,1).^5).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*(0.25.*(log10(ee./(3.7.*D(1,1))+2.51*3.14*vs.*D(1,1)./(4.*Qy(1)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(21).*abs(Qy(21)*8.*L(1,21)*1./(9.81*3.14.^2.*D(1,21).^5).*(0.25.*(log10(ee./(3.7.*D(1,21))+2.51*3.14*vs.*D(1,21)./(4.*Qy(21)).*(0.25.*(log10(ee./(3.7.*D(1,21))+2.51*3.14*vs.*D(1,21)./(4.*Qy(21)).*(0.25.*(log10(ee./(3.7.*D(1,21))+2.51*3.14*vs.*D(1,21)./(4.*Qy(21)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(1.*Qy(22).*abs(Qy(22)*8.*L(1,22)*1./(9.81*3.14.^2.*D(1,22).^5).*(0.25.*(log10(ee./(3.7.*D(1,22))+2.51*3.14*vs.*D(1,22)./(4.*Qy(22)).*(0.25.*(log10(ee./(3.7.*D(1,22))+2.51*3.14*vs.*D(1,22)./(4.*Qy(22)).*(0.25.*(log10(ee./(3.7.*D(1,22))+2.51*3.14*vs.*D(1,22)./(4.*Qy(22)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+(-4);...
(1.*Qy(1))+(-1.*Qy(2))+(-2.472000e-01);...
(1.*Qy(2))+(-1.*Qy(3))+(-1.*Qy(19))+(-1.*Qy(20))+(-2.361000e-01);...
(1.*Qy(3))+(-1.*Qy(4))+(-3.610000e-02);...
(1.*Qy(4))+(-1.*Qy(5))+(-2.014000e-01);...
(1.*Qy(5))+(-1.*Qy(6))+(-2.792000e-01);...
(1.*Qy(6))+(-1.*Qy(7))+(-3.750000e-01);...
(1.*Qy(7))+(-1.*Qy(8))+(-1.528000e-01);...
(1.*Qy(8))+(-1.*Qy(9))+(-1.458000e-01);...
(1.*Qy(9))+(-1.*Qy(10))+(1.*Qy(13))+(-1.458000e-01);...
(1.*Qy(10))+(-1.*Qy(11))+(-1.389000e-01);...
(1.*Qy(11))+(-1.*Qy(12))+(-1.556000e-01);...
(1.*Qy(12))+(-2.611000e-01);...
(-1.*Qy(13))+(1.*Qy(14))+(-1.708000e-01);...
(-1.*Qy(14))+(1.*Qy(15))+(-7.780000e-02);...
(-1.*Qy(15))+(1.*Qy(16))+(-1.*Qy(28))+(-8.610000e-02);...
(-1.*Qy(16))+(1.*Qy(17))+(-2.403000e-01);...
(-1.*Qy(17))+(1.*Qy(18))+(-3.736000e-01);...
(-1.*Qy(18))+(1.*Qy(19))+(-1.670000e-02);...
(1.*Qy(20))+(-1.*Qy(21))+(-1.*Qy(23))+(-3.542000e-01);...
(1.*Qy(21))+(-1.*Qy(22))+(-2.583000e-01);...
(1.*Qy(22))+(-1.347000e-01);...
(1.*Qy(23))+(-1.*Qy(24))+(-1.*Qy(29))+(-2.903000e-01);...
(1.*Qy(24))+(-1.*Qy(25))+(-2.278000e-01);...
(1.*Qy(25))+(1.*Qy(26))+(-4.720000e-02);...
(-1.*Qy(26))+(1.*Qy(27))+(-2.500000e-01);...
(-1.*Qy(27))+(1.*Qy(28))+(-1.028000e-01);...
(1.*Qy(29))+(-1.*Qy(30))+(-8.060000e-02);...
(1.*Qy(30))+(-1.*Qy(31))+(-1.000000e-01);...
(1.*Qy(31))+(-1.*Qy(32))+(-1.000000e-01);...
(1.*Qy(32))+(1.*Qy(33))+(-2.920000e-02);...
(-1.*Qy(33))+(1.*Qy(34))+(-2.236000e-01)];
options = optimoptions('fsolve','Display','iter',MaxIterations=100000, MaxFunctionEvaluations=100000, Algorithm='levenberg-marquardt'); % 'levenberg-marquardt'
[Qy] = fsolve(FUN, Qy0, options);
for i=1:size(D,2)
vel=abs(4*Qy(i,1)./(3.14*D(1,i).^2)); [rn, cn]=find(Dia(1,1:szDia)<D(1,i),1,'first'); [rx, cx]=find(Dia(1,1:szDia)>D(1,i),1,'first'); % vel_mn=0.5*Dia(2,i);
if isempty(rn)&&isempty(rx)
elseif vel<0.3 && ~isempty(rn); D(1,i) = Dia(1,cn);
elseif vel>2.0 && ~isempty(rx); D(1,i) = Dia(1,cx);
else (~isempty(rn)&&~isempty(rx))&&((vel<2&&vel>0.3)); end
end
DD(n,:) = D(:); D = D; %Qy=Qy,
end
DD, Li=L'; Di=D'; vel=abs(4*Qy(:,1)./(3.14.*(Di(:,1)).^2)); Re=abs(4.*Qy(:,1)./(3.14*vs.*Di(:,1)));
fy11=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)*0.0001.^0.5)); fy1=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)).*fy11.^0.5); fy=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)).*fy1.^0.5); f=-2*log10(ee./(3.7.*Di(:,1))+2.51*3.14*vs.*Di(:,1)./(4.*Qy(:,1)).*fy.^0.5); ff=(1./f).^2;
n=7; Data1=zeros(p,n); Data1(:,1)=Li(:,1); Data1(:,2)=Di(:,1); Data1(:,3)=Qy(:,1); Data1(:,4)=vel(:,1); Data1(:,5)=ff(:,1); Data1(:,6)=Re(:,1); Data1(:,7)=8./(9.81*3.14.^2).*Data1(:,5).*Data1(:,1).*(Data1(:,3)).^2./(Data1(:,2)).^5;
StrNum={'string','double','double','double','double','double','double','double'}; subTitl={'Pipes [x-z]', 'Length [m]', 'Diameter [m]', 'Flow rate [m3/s]', 'Velocity [m/s]', 'Friction, f', 'Reynold No.', 'Headlosses [m]'};
tz=table('size', [p, 8], 'variabletypes',StrNum, 'variablenames', subTitl); Pipexz=["1P","2P","3P","4P","5P","6P","7P","8P","9P","10P","11P","12P","13P","14P","15P","16P","17P","18P","19P","20P","1P","2P","3P","4P","5P","6P","7P","8P","9P","10P","11P","12P","13P","14P"];
tz{:,1}=Pipexz'; tz{:,2:8} = Data1(:,1:7), toc, % tz{:,2:cCc+0} = Data1(:,1:cCc), % MIDsrt=sortrows(tz,sn); MIDfn=MIDsrt; MIDfn(:,end)=[ ];
end
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!