1 answer

. (25 points) The recurrence relation for the Newton's Raphson method is a)0.1.2 f(r.) F(z.) The ...

Question:

. (25 points) The recurrence relation for the Newtons Raphson method is a)0.1.2 f(r.) F(z.) The derivative of the function c
. (25 points) The recurrence relation for the Newton's Raphson method is a)0.1.2 f(r.) F(z.) The derivative of the function can be approximately evaluated using finite-difference method. Consider the Forward and Centered finite-difference formulas Forward Finite-Difference Centered Finite-Difference 2h It is worthwhile to mention that modified secant method was derived based on the forward finite- difference formula. Develop a MATLAB functions that has the following syntax function [root,fx,ea,iter]-modnetraph (func,x0,h,es,maxit,sethod, varargin) % modnevtraph: root location zeroes of nonlinear equation f (x) 0 % [root , fx ea, iter) "nodnevtraph(func .xo,b,es,saxit,method,p1.p2,..): % uses modified Newton's Raphson method to find the root of func % inputs: func name of function x0 initial guess h fixed increment to approxinate the derivative ea " desired relative error (default . 0.0001%) % maxit maximum allowable iterations (default-50) method - A string input (F or C) to specify either Forvard or pi,p2, root real root Centered finite-difference formulas (defaultc) aneters used by function % outputs: ea-approximate relative error (%) ter number of iterations 10-6 Test your developed function the following test functions using h Hint: Use avitch command. 0.05 and es

Answers



function [root,fx,ea,iter] = modnewtraph(func,x0,h,es,maxit ,method,p)
switch nargin %this is used to set the default values so it required at leat three input , otherwise it will show error
case 3
es = 0.0001 ;
maxit = 50;
method = "C";
p = 0 ; % additional parameter for function
case 4
maxit = 50;
method = "C";
p = 0 ;
case 5
  
method = "C";
p = 0 ;
case 6
p = 0;
  
end
are = 10 ; %%initialise approximate relative error as 10
X0 = x0;
itr = 0; %% initialise iteration variable to keep track of no. of iteration
while(are> es) %%% check if the current ARE is greater then the desired error
itr = itr + 1 ; % increment the itration value to keep track of iteration
if(method =="F")
F_dotX = (func(X0 + h,p) - func(X0,p))/h; %%for Forward finite difference
else
F_dotX = (func(X0 + h,p) - func(X0-h,p))/(2*h); %calculate the derivative of function according to the method,for %centered finite difference
end;
  
  
X1 = X0 - func(X0,p)/F_dotX; %apply Newton_Raphson rule , RECURRENCE formula
  
are = abs(X1-X0)*100/abs(X0) ;%Calculate approximate relative error
  
X0 = X1;
if(maxit ==itr) %%while the iteration is equal to maximum iterarion break the loop
break;
end;
end
fx = func(X1,p);
root =X1;
ea = are;
iter=itr;
  
end

%%%PLEASE UPVOTE !!!!! THANKS

.

Similar Solved Questions

1 answer
Please show in Excel 7.4 Using the following weekly demand data for a new soft drink,...
Please show in Excel 7.4 Using the following weekly demand data for a new soft drink, determine the upper and lower control limits that can be used in recognizing a change in demand patterns. Use ±3σ control limits. Week Demand (six packs) 3500 4100 3750 4300 4000 3650 4...
1 answer
3. Suppose that xi, ,xn are a random sample from a B(o, β) distribution: ere E[X...
3. Suppose that xi, ,xn are a random sample from a B(o, β) distribution: ere E[X H -a/(a + β) and EX2] (a + 1)a/( (a + β + 1)(a + β)) (a) Show that the method of moments, using the first two moments, gives the equations (b) Determine the method of moments estimator of α and...
1 answer
In a closed rigid vessel that does not have any type of work interactions with the...
In a closed rigid vessel that does not have any type of work interactions with the surroundings the amount of heat that needs supplied to heat a liquid inside the container can be determined by the change in internal energy. Suppose you have a sealed pan with 1 liter of water at 20 °C and 100 kP...
1 answer
14. David's firm experiences diminishing marginal product for all ranges of inputs. The total cost curve...
14. David's firm experiences diminishing marginal product for all ranges of inputs. The total cost curve associated with David's firm a. is constant for all ranges of output. b. gets flatter as output increases. c. is unrelated to the production function. d. gets steeper as output increases....
1 answer
A) If A is a 3 x 6 matrix and Rank(A) = 2, then what is...
a) If A is a 3 x 6 matrix and Rank(A) = 2, then what is the dimension of Nul(A)? b) If B is a 8 x 5 matrix and the dimension of Nul(B) = 3, what is the dimension of Col(B)? c) If C is a 4 x 8 matrix, what is the largest possible dimension of Row(C)?...
1 answer
A certain reaction has an activation energy of 65.75 kJ/mol. At what Kelvin temperature will the...
A certain reaction has an activation energy of 65.75 kJ/mol. At what Kelvin temperature will the reaction proceed 6.50 times faster than it did at 349 K? Number...
1 answer
Match each diagram with the corrext optical element Match each diagram with the appropriate optical element...
match each diagram with the corrext optical element Match each diagram with the appropriate optical element (convex, concave, plane, converging, divergent) + LE LE...
1 answer
Jestion Completion Status: QUESTION 1 Information from the left visual field travels through the eye, to...
Jestion Completion Status: QUESTION 1 Information from the left visual field travels through the eye, to the left nasal retina, via the left optic nerve through the optic chiasma, to the right lateral geniculate nucleus of the to the primary visual cortex of the right occipital lobe. QUESTION 2 The ...
1 answer
An object, previously at rest, slides #3 m# down a ramp, with an incline of #pi/6 #, and then slides horizontally on the floor for another #4 m#. If the ramp and floor are made of the same material, what is the material's kinetic friction coefficient?
An object, previously at rest, slides #3 m# down a ramp, with an incline of #pi/6 #, and then slides horizontally on the floor for another #4 m#. If the ramp and floor are made of the same material, what is the material's kinetic friction coefficient?...
1 answer
Suppose that a random variable X follows a distribution with mean 100 and variance 81. We...
Suppose that a random variable X follows a distribution with mean 100 and variance 81. We take a random sample of 240 observations and calculate x. What is the probability that we calculate a sample mean larger than 101?...
1 answer
EXAMPLE 3 Find dx. 13 - 2x² SOLUTION Let u = 3 - 2x. Then du...
EXAMPLE 3 Find dx. 13 - 2x² SOLUTION Let u = 3 - 2x. Then du dx, so x dx du and 1 3 = 2x2 dx = = 1.I tu du 1 wrz du (27ū)+c 11 Il + C (in terms of x)....
1 answer
I need help 6. (14 youraaitse Using 13 froan the peri-peublem. r? Circle th, appropriate-er e YES oF NO 7. (14 points) Cossider the language Ls -i Mf is a Turing machise that halts when started o...
i need help 6. (14 youraaitse Using 13 froan the peri-peublem. r? Circle th, appropriate-er e YES oF NO 7. (14 points) Cossider the language Ls -i Mf is a Turing machise that halts when started on as enpty tape) So? Circle the appropriate answer and justify your answer Is Ls E YES or NO Σ...
1 answer
Determine if the following sets are subspaces. Explain your answer 1. The unit disk in R2,...
Determine if the following sets are subspaces. Explain your answer 1. The unit disk in R2, that is the set {(r, y) E R2 r2y s 2. The plane 2 3y 0 in R3 1)...
1 answer
Dell Computer Please answer the question based on the below Dell case: Q- Conduct Value Chain...
Dell Computer Please answer the question based on the below Dell case: Q- Conduct Value Chain "Primary activities and Support activities" analysis of Dell ? Dell Computer is one of the most extraordinary success stories in business history. Started in 1984 by Michael Dell in his dorm room wh...
1 answer
Incubator buildings: 1) are typically single tenant structures. 2) are usually owner-occupied. 3) are often attractive...
Incubator buildings: 1) are typically single tenant structures. 2) are usually owner-occupied. 3) are often attractive to tenants that expect to expand into larger quarters in the near future. 4) are usually rented on long-term, triple-net leases....
1 answer
A case-control study is characterized by all of the following except: Cases with the disease are...
A case-control study is characterized by all of the following except: Cases with the disease are compared to controls without the disease Relative risk of disease can be calculated The assessment of past exposure may be biased Finding appropriate controls can be challenging...
1 answer
? Tell me what you want to do Inless you need to edit, it's safer to...
? Tell me what you want to do Inless you need to edit, it's safer to stay in Protected View. Enable Editing Problem 1 Consider the cable shown in the figure, determine the magnitude of horizontal force P so that xp 6ft. S h 8 i st 2 tt tO Ih の...