MatLab Program:
clear;
clc;
%n=input('Enter the number of equations: ');
n=4;
f=cell(n,1);
%x(1)=delta P
%x(2)=w1
%x(3)=w3
%x(4)=w
f{1}=@(x) x(1)-810+25*x(2)+3.75*x(2)^2;
f{2}=@(x) x(1)-900+65*x(3)+30*x(3)^2;
f{3}=@(x) x(1)-7.2*x(4)^2-392.8;
f{4}=@(x) x(2)+x(3)-x(4);
% initial guess
x=[750;3;1.5;5];
% tolerance
tol=1e-5;
% delta used in finding derivation
delta=0.0001;
Er=Inf;
J=zeros(n,n);
F=zeros(n,1);
iteration=0;
while Er>tol
for i=1:n
for j=1:n
X=x;
X(j)=X(j)+delta;
J(i,j)=(1/delta)*(f{i}(X)-f{i}(x));
end
F(i,1)=-f{i}(x);
end
Aug=[J F];
for i=1:1:n-1
for j=i+1:n
Aug(j,:)=Aug(j,:)-(Aug(j,i)/Aug(i,i))*Aug(i,:);
end
for j=i-1:-1:1
Aug(j,:)=Aug(j,:)-(Aug(j,i)/Aug(i,i))*Aug(i,:);
end
end
dX=zeros(n,1);
for i=1:n
dX(i,1)=Aug(i,n+1)/Aug(i,i);
end
Er=sqrt(sum(F.*F));
for i=1:n
x(i)=x(i)+dX(i);
end
iteration=iteration+1;
end
fprintf('The solution after %d iterations are\n',iteration);
disp(x);
Screenshot
Save the above program and execute it.
Result:
delta P = 650.6586
w1=3.9880
w2=1.9964
w=5.9845
I hope this will help you, please give me thumbs up.
Use Newton-Raphson root-finding method to solve. A water-pumping system consists of two parallel pumps drawing water...
Two parallel pumps are pumping water (p = 1000 kg/m) through very large diameter pipes of diameter D such that the friction losses in the piping and kinetic energy changes are negligible. The height between the elevation level d and the elevation level a is Had = 100 meters. The equation for the system resistance curve (SRC) is: Ap = pg Had The equation for each pump performance curve running at 1760 rpm is given by Ap = 981 +...