part 1)
x_left = 9.0625
x_right = 9.3750
we are trying to minimize the interval for searching of solution by bisection method and simultaneously find and reduce the mid which is x_new to zero, so from the given table we can deduce the above x_left and x_right.
part2)
CODE
function [out] = myNewton(f,x0, tol)
%initial high error
err=1;
syms x
%calculating differentiation
df = eval(['@(x)' char(diff(f(x)))])
while err > tol
del= -f(x0)/df(x0);
x0=x0 +del ; %using newton - raphsn method
err= abs(del/x0); %calulating error in each iteration
end
out = x0;
end
SCREENSHOTS
Please go through above code and explanation and if any doubts then comment.
Give me a thumbs up . Thanks.
MATLAB Given a table like this one: i xLeft xRightyLeftyRight xNew yNew 3 8.75 10.000 173.05 -200.0. 9.3750 -12.7441 4 8.75 9.3750 173.05 -12.74 9.0625 80.4260 On iteration 5 of Bisection, what is xL...
I'm working on the newton's method on matlab, could someone help me and show what two lines are needed to be added in the codes in order to make this function work? function sample_newton(f, xc, tol, max_iter) % sample_newton(f, xc, tol, max_iter) % finds a root of the given function f over the interval [a, b] using Newton-Raphson method % IN: % f - the target function to find a root of % function handle with two outputs, f(x), f'(x)...
Programming Language: MATLAB
Problem 3: (5 Points) Write a function with the header: function [R] -myNewtonRaphson (f, fp, x0, tol) which takes as input f: a function handle fp: a function handle to the derivative of f (note how I do it in the test case). x0: the initial guess of the root tol: a tolerance above which the algorithm will keep iterating. Tips: . Be sure to include an iteration counter which will stop the while-loop if the number...