Question

You are given the following function y = x^4 - 12

0 0
Add a comment Improve this question Transcribed image text
Answer #1

% function biection method, parametres are function and limits.
function res = Bisect(f,a,b)
errArr = []
index = 1
if f(a)*f(b)>0
disp('Inputs wrong..')
else
res = (a + b)/2;
err = abs(f(res));
while err > 1e-5 %checking limit
errArr(index) = err % storing into array
fprintf('Root at iteration: %d is %f',index,res);
index = index + 1
if f(a)*f(res)<0
b = res;
else
a = res;
end
res = (a + b)/2; % result calculating every step
err = abs(f(res));
end
end
fprintf('Root calculated for equation is %f',res);
plot(errArr);
title('Error plot')
xlabel('iterations')
ylabel('Error')
end

f=(x) x^4 - 12*x^3 + 49*x^2 - 78*x + 40
ans = Bisect(f,-5,5)

TABLE

Root at iteration: 3 ---->3.750000 Root at iteration: 5 -- 4.062500 Root at iteration: 6 - 3.906250 Root at iteration: 7 ----

Error plot 40 r 35 30 25 15 10 15 20 iterations

Add a comment
Know the answer?
Add Answer to:
You are given the following function y = x^4 - 12x^3 + 49x^2 - 78x +...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5.1.2 Open Methods - Newton-Raphson Method Xi+1= xi – FOTO Matlab Code Example:4 function mynewtraph (f,...

    5.1.2 Open Methods - Newton-Raphson Method Xi+1= xi – FOTO Matlab Code Example:4 function mynewtraph (f, f1,x0,n) Xx0; for ilin x = x - f(x)/f1(x); disp (li if f(x) <0.01 f(x))) break end end end Matlab Code from Chapra function [root, ea, iter)=newtraph (func,dfunc, xr, es,maxit,varargin) newtraph: Newton-Raphson root location zeroes 8 [root, ea, iter)-newtraph (func, dfunc, xr, es,maxit,pl,p2, ...): $uses Newton-Raphson method to find the root of fune input: func- name of function 8dfunc = name of derivative of...

  • 45-3. Modify the code used in Example 4 to find the root only at f(x)<0.01 using...

    45-3. Modify the code used in Example 4 to find the root only at f(x)<0.01 using Newton-Rephson Method without showing any iteration. Also find the root of equation, f(x) = x 9-3x -10, take initial guess, Xo=2 العقدة College of 9:05 mybb.qu.edu.ca Numerical Methods (Lab.) GENG 300 Summer 2020 5.1.2 Open Methods - Newton-Raphson Method f(x) *1+1 = x; - Matlab Code Example:4 function mynewtraph.t1.x0,-) XXO for ilin x - x - x)/1 x) disp 1 x) <0.01 break end...

  • ____________ % This function is a modified versio of the newtmult function obtained % from % “Ap...

    ____________ % This function is a modified versio of the newtmult function obtained % from % “Applied Numerical Methods with MATLAB, Chapra, % 3rd edition, 2012, McGraw-Hill.” function [x,f,ea,iter]=newtmult(func,x0,es,maxit,varargin) % newtmult: Newton-Raphson root zeroes nonlinear systems % [x,f,ea,iter]=newtmult(f,J,x0,es,maxit,p1,p2,...): % uses the Newton-Raphson method to find the roots of % a system of nonlinear equations % input: % f = the passed function % J = the passed jacobian % x0 = initial guess % es = desired percent relative error...

  • Numerical Analysis hr2 h 2 f(x) = a. x3. e-(0.1)x -- +4. x. In(x) – 1500...

    Numerical Analysis hr2 h 2 f(x) = a. x3. e-(0.1)x -- +4. x. In(x) – 1500 = 0 VX + 2 We want to find the root of the above equation. (In order to ease the reading, points are used between variables. Only the number above “e” is equal to “zero point one”.) b) If "a=1.5” and “b=0.8" at the above function, find the root between Xa=50 and Xu=70 using method of false position “Regula-Falsi” until Ea of approximation satisfies...

  • The following 4th order polynomial has 4 distinct real roots: x^4 + 6x^3 + 7x^2 −...

    The following 4th order polynomial has 4 distinct real roots: x^4 + 6x^3 + 7x^2 − 6x − 8 = 0 Create a function for the false-position method then use it to find the 4 different roots. Use a precision of 0.001.

  • the goal is to enter the beginning and end of the interval and return the root Extra: Can a function return a sentence with the calculated value and the iterations? function raiz=biseccion(xa,x...

    the goal is to enter the beginning and end of the interval and return the root Extra: Can a function return a sentence with the calculated value and the iterations? function raiz=biseccion(xa,xb) clear all; close all; clc; %Método de bisección f=inline('cos(x.^2+1)./(x+1)','x');; % Resuma lo que se hacen en estas líneas ezplot(f); grid on; hold all; %Grafica la funcion f %Define el punto inicial y final del intervalo    xk =[]; % epsilon = 10^(-4); % n=0;    while (abs(xa-xb)>=epsilon || n~=350) %Si...

  • Question 2: 60 Marks The function fx)-x-2x3-5x2+12x -5 as four distinct roots, we want to determine...

    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 =...

  • Given the following function f(x)= 5x^4 − 32x^3 +120x^2 −182x + 86, 1) evaluate one of...

    Given the following function f(x)= 5x^4 − 32x^3 +120x^2 −182x + 86, 1) evaluate one of its roots using the fixed point iteration and using an initial guess of x = 0. If you approach this problem by adding x and subtracting x (i.e., f(x) + x – x = 0 that is x =x + f(x)), the method will fail. Explain why analytically. (b) In part (a), suggest a remedy that makes the simple fixed-point iteration work. Please show...

  • x if x>3 if 2<x<3 if x < 2 Given the following piecewise function: f(x)={-x |-0.5x...

    x if x>3 if 2<x<3 if x < 2 Given the following piecewise function: f(x)={-x |-0.5x if it exists. h Find lim f(2+h)-f(2) -0+

  • 4. Consider the following partial information about a function f(x): S.x2, 0<x<I, (2-x), 1<x<2. Given that...

    4. Consider the following partial information about a function f(x): S.x2, 0<x<I, (2-x), 1<x<2. Given that the function can be extended and modelled as a Fourier cosine-series: (a) Sketch this extended function in the interval that satisfies: x <4 (b) State the minimum period of this extended function. (C) The general Fourier series is defined as follows: [1 marks] [1 marks] F(x) = 4 + ] Ancos ("E") + ] B, sin("E") [1 marks] State the value of L. (d)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT