ANSWER:-
MAT LAB CODE:-
OUT PUT SCREEN SHOT:-
MAT LAB CODE:-
f = @(x) 2*x.^3 - 4*x.^2 - 22*x + 24;
df = @(x) 6*x.^2 - 8*x - 22;
x = linspace(-5,5);
% Plotting Function and zero line to see 3 roots
plot(x,f(x))
xlabel("x"); ylabel("f(x)");
grid on
yline(0); % plotting zero line to identify roots
%%%%%%%%% Bisection Method %%%%%%%%%%%
% For interval (-4,-2)
x1_bis = Bisection(f,-4,-2);
% For Interval (0,2)
x2_bis = Bisection(f,0,2);
% For Interval (3,5)
x3_bis = Bisection(f,3,5);
%%%%%%%%% Newton's Method %%%%%%%%%%%
% For starting value (-4)
x1_NR = NR(f,df,-4);
% For starting value (0)
x2_NR = NR(f,df,0);
% For starting value (3)
x3_NR = NR(f,df,3);
fprintf("\n 3 roots by Bisection Method : %.3f \t %.3f \t
%.3f",x1_bis,x2_bis,x3_bis);
fprintf("\n 3 roots by Newton's Method : %.3f \t %.3f \t
%.3f",x1_NR,x2_NR,x3_NR);
%Function for bisection method
function xr = Bisection(f,xl,xu)
% f is function
% xl ,xu are initial Guesses
error = 1; % Initializing Error
tol = 10^-6;
while(error>=tol)
xr = (xl+xu)/2; % New Guess Calculation
if f(xl)*f(xr) < 0 % Checking Condition for guess
replacement
xu = xr;
else
xl = xr;
end
error = abs(f(xr)); % Defining error
end
end
% Function For NR
function x2 = NR(f,df,x1)
% f is function
% df is derivative function
% x1: Initial Guess
error = 1; % Initializing Error
tol = 1e-6; % Setting Tolerance
while (error >= tol)
x2 = x1 - (f(x1)/df(x1)); % Calculation of next guess
error = abs(f(x2)); % Defining Error
x1 = x2; % Replacing Guesses
end
end
3. Write a code to find 3 roots of the function f(x)-2x3-4x2-22x+24 for the interval -5, 5] consi...
3. Write a code to find 3 roots of the function f(x) 2r3-4x2 -22x +24 for the interval I-5, 5] considering the following methods a) Bisection Method b) Newton's Method Hint: Plot a graph of f(x) and determine proper intervals and initial guesses for a) and b), respectively. 3. Write a code to find 3 roots of the function f(x) 2x3-4x2 -22x +24 for the interval [-5, 5] considering the following methods a) Bisection Method b) Newton's Method Hint: Plot...
in matlab -Consider the equation f(x) = x-2-sin x = 0 on the interval x E [0.1,4 π] Use a plot to approximately locate the roots of f. To which roots do the fol- owing initial guesses converge when using Function 4.3.1? Is the root obtained the one that is closest to that guess? )xo = 1.5, (b) x0 = 2, (c) x.-3.2, (d) xo = 4, (e) xo = 5, (f) xo = 27. Function 4.3.1 (newton) Newton's method...
Problem 5, using Matlab MATLAR problem: Problem S: Determine the roots of f(x)=-12-21x+18r-2.75r with the methods of bisection, and false position. Please use initial guesses of x--1 and x-0, and a stopping criterion of 1%
please show answer in full with explanation, also show matlab 1. Consider the function f(x)2.753 +18r2 21 12 a) Plot the graph of f(x) in MATLAB and find all the roots of the function f(x) graphically. Provide the code and the plot you obtained. b) Compute by hand the first root of the function with the bisection method, on the interval -1; 0) for a stopping criterion of 1% c) How many iterations on the interval -1, 0 are needed...
For the function F(x) = 24 – 14x² + 60.x2 – 702 find minimum value using two methods - a. Newton's method starting with initial point of 1 b. Golden section in the interval [0,2] required tolerance =0.001
Question 2: 60 Marks The function fx)-x-2x3-5x2+12x -5 as four distinct roots, we want to determine the roots by means of Müller's method (2.1) Which option is false? (10) (1) f(x) x-2x3-5x 12x-5 has no singularities and no obvious symmetries and f(0)--5 (2) f(x) 4x3 6x2-10x 12, f(x) 12x2 - 12x (3) f"(x) has a local ertremum at X = 0.5 (4) the two zeros for f"(x) are -0.5408 and 1.5408 (5) f"(x) has a local marinum at X =...
2) (15 points) a) Determine the roots of f(x)=-12 – 21x +18r? - 2,75x' graphically. In addition, determine the first root of the function with b) bisection and c) false-position. For (b) and (c), use initial guesses of x, =-land x, = 0, and a stopping criterion of 1%. 3) (25 points) Determine the highest real root of f(x) = 2x – 11,7x² +17,7x-5 a) Graphically, b) Fixed-point iteration method (three iterations, x, = 3) c) Newton-Raphson method (three iterations,...
In MATLAB please Consider the nonlinear function: y = f(x) = x3 cos x a. Plot y as a function of x as x is varied between -67 and 67. In this plot mark all the locations of x where y = 0. Make sure to get all the roots in this range. You may need to zoom in to some areas of the plot. These locations are some of the roots of the above equation. b. Use the fzero...
8 Question 3 (2 points) The roots of the equation f(x) = 0 9 is known to lie on the interval (-2, 5]. What will be the minimum number of iterations of Bisection method need to guarantee the approximation to the root is correct to within £10-5 21 19 18 20 Next Page Page 3 of 8
Write code to approximate 3 Squareroot 7 (cubic square of 7) by applying the a) bisection method and b)false position methods to the equation x^3 - 7 = 0. You choose the starting guesses-these will be the Cody input. Determine the result accurate to at least to 5 sig figs!