Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this problem, you will solve for the flow rates in each pipe in the water distribution network shown in Figure 1. (Please complete all

In this problem, you will solve for the flow rates in each pipe in the water distribution network shown in Figure 1.

(Please complete all parts and include Matlab codes, Thank You)

image text in transcribed

image text in transcribed

image text in transcribed

function newton_sys_new.m is provided here:

function [solution,it_count,error] = newton_sys_new(x_init,...

err_tol,max_iterates,func_name,jacobian_func_name) % % The calling sequence for newton_sys_new.m is % solution = newton_sys_new(x_init,err_tol,max_iterates) % This solves n nonlinear equations in n unknowns, % F(x) = 0 % with F(x) a column vector of length n. The definitions of F(x) % and the Jacobian matrix for F(x) are provided in the input function % names. % % x_init is a vector of length n, and it is an initial guess % at the solution. % % The parameters err_tol and max_iterates are upper limits on % the desired error in the solution and the maximum number of % iterates to be computed. % % Initialization. n=length(x_init);

x0=zeros(n,1); for i=1:n x0(i) = x_init(i); end

error = inf; it_count = 0;

% Begin the main loop. while error > err_tol & it_count

% Return with the solution. solution = x1; if it_count == max_iterates disp(' ') disp('*** Your answers may possibly not satisfy your error tolerance.') end

Example definitions of functions fsys.m and deriv_fsys.m ( Please do not use if they are not correct ones)

function f_val = fsys1(x) % The equations being solved are % x(1)^2 + 4*x(2)^2 - 9 = 0 % 18*x(2) - 14*x(1)^2 + 45 = 0 % f_val = [x(1)^2+4*x(2)^2-9, 18*x(2)-14*x(1)^2+45]';

function f_val = fsys1(x) % The equations being solved are % x(1)^2 + 4*x(2)^2 - 9 = 0 % 18*x(2) - 14*x(1)^2 + 45 = 0 % f_val = [x(1)^2+4*x(2)^2-9, 18*x(2)-14*x(1)^2+45]';

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions