Question

Determine the second highest and the second lowest real root at an interval of 10 81 for the following function y-(ap +9)sin(
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The Matlab Scripts secant.m and secantSolver.m are posted below. Run the Matlab script secantSolver.m to display the second lowest and highest root in the interval [0, 8] in the command window.

Also note that the estimate of the interval within the interval [0, 8] within which the second lowest and second highest root lies are obtained by plotting the graph of y vs t which will also be displayed when you run the script.

secant.m

function [root, fx, iter]= secant(func, xl, xu, es, maxIter)

% [root, fx, iter] = secant(func, xl, xu, es, maxIter):

% input:
% func = name of function
% xl, xu = lower and upper guesses
% es = desired relative error
% maxIter = maximum allowable iterations

% output:
% root = real root
% fx = function value at root
% iter = number of iterations

for iter = 1: maxIter
  
    xi = xu - func(xu) * (xl - xu) /(func(xl) - func(xu)) ;
    if abs((xi - xu) / xu) < es
        root = xi;
        fx = func(root);
        break
    end
    xl = xu;
    xu = xi;
end
if iter > maxIter
    fprintf('Solution was not obtained in %i iterations. \n' , maxIter)
    root = fprintf('No answer') ;
end

secantSolver.m

clear, clc, close all;

tt = linspace(0, 8);
yy = (4*tt.^2+9).*sin(tt) - (tt.^3-6*tt+34).*cos(2*tt+pi);

figure
plot( tt, yy )
xlabel( 't' )
ylabel( 'y' )
grid on

y = @(t) (4*t^2+9)*sin(t) - (t^3-6*t+34)*cos(2*t+pi);
sec_low = secant(y, 1, 2, 1e-3, 1000);
sec_high = secant(y, 5, 6, 1e-3, 1000);

fprintf('The second lowest real root in interval [0, 8] is %0.5f.\n', sec_low);
fprintf('The second highest real root in interval [0, 8] is %0.5f.\n', sec_high);

Add a comment
Know the answer?
Add Answer to:
Determine the second highest and the second lowest real root at an interval of 10 81...
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
  • Determine the second highest and the second lowest real root at an interval of 10 81...

    Determine the second highest and the second lowest real root at an interval of 10 81 for the following function y-(4+9)sin()-(*-6+34)cos (21+) (1) Apply Secant method to determine both roots with stopping error of E-0.1% For all calculation, use at least 5 significant figures for better accuracy [25 Marks] Determine the second highest and the second lowest real root at an interval of 10 81 for the following function y-(4+9)sin()-(*-6+34)cos (21+) (1) Apply Secant method to determine both roots with...

  • Using Newton method, find the value of t that give a maximum value at an interval...

    Using Newton method, find the value of t that give a maximum value at an interval of [0 10] for the following function: 2 sin (- y (2) Use initial guess of t = 0.1 with stopping error of &s = 0.01%. Apply centered finite-difference formulas with step size of h 0.01 to calculate the derivatives For all calculation, use at least 5 significant figures for better accuracy. Using Newton method, find the value of t that give a maximum...

  • 3. (30 pts) (Problem 6.2) Determine the highest real root of f(x) 2x3- 11.7x2 + 17.7x...

    3. (30 pts) (Problem 6.2) Determine the highest real root of f(x) 2x3- 11.7x2 + 17.7x -5 a) Graphically. b) Write a MATLAB program using the fixed-point method to determine the root with xo- Write a MATLAB program using the Newton-Raphson method to determine the root with Xo-3. c) d) Write a MATLAB program using the secant method to determine the root with x-1-3 and Xo- 4. e) Compare the relative errors between these three methods at the third iteration...

  • Need solution for question 5.6 using python? tation to within e, 5.11 Determine the real root...

    Need solution for question 5.6 using python? tation to within e, 5.11 Determine the real root of x 80: (a) analytically and (b) with the false-position method to within e, = 2.5%. Use initial guesses of 2.0 and 5.0. Compute the estimated error Ea and the true error after each 1.0% teration 5.2 Determine the real root of (x) 5r - 5x2 + 6r -2 (a) Graphically (b) Using bisection to locate the root. Employ initial guesses of 5.12 Given...

  • 2) (15 points) a) Determine the roots of f(x)=-12 – 21x +18r? - 2,75x' graphically. In...

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

  • 2. A comparative problem: Determine the highest real root of flx)-2x3-11.7x'+17.7x-5 You will achieve this by...

    2. A comparative problem: Determine the highest real root of flx)-2x3-11.7x'+17.7x-5 You will achieve this by performing 3 iterations of the following methods. In each case, calculate the approximate relative error at each iteration (a) The bisection method with starting guesses x 3 and u-4 (b) New Raphson method using Xo 3 as a starting guess. (c) Fixed point iteration usingx 3 as a starting guess but make sure that the method will work (see question 1.b above). (d) Which...

  • MATLAB QUESTION please include function codes inputed Problem 3 Determine the root (highest positive) of: F(x)=...

    MATLAB QUESTION please include function codes inputed Problem 3 Determine the root (highest positive) of: F(x)= 0.95x.^3-5.9x.^2+10.9x-6; Note: Remember to compute the error Epsilon-a after each iteration. Use epsilon_$=0.01%. Part A Perform (hand calculation) 3 iterations of Newton's Raphson method to solve the equation. Use an initial guess of x0=3.5. Part B Write your own Matlab function to validate your results. Part C Compare the results of question 1 to the results of question 2, what is your conclusion ?

  • I need help creating program for the Test_Bisection pseudocode. I need to find a root for...

    I need help creating program for the Test_Bisection pseudocode. I need to find a root for each function f and g and get the output below. Pseudocode Now let's construct pseudocode to carry out this procedure. We shall not try to create a piece of high-quality software with many "bells and whistles,” but we write the pseudocode in the form of a procedure for general use. This allows the reader an opportunity to review how a main program and one...

  • Using MATLAB or FreeMat ---------------------------- Bisection Method and Accuracy of Rootfinding Consider the function f(0) =...

    Using MATLAB or FreeMat ---------------------------- Bisection Method and Accuracy of Rootfinding Consider the function f(0) = 3 cos 2r cos 4-2 cos Garcos 3r - 6 cos 2r sin 2r-5.03r +5/2. This function has exactly one root in the interval <I<1. Your assignment is to find this root accurately to 10 decimal places, if possible. Use MATLAB, which does all calculations in double precision, equivalent to about 16 decimal digits. You should use the Bisection Method as described below to...

  • 5. (12.5%) The ideal D/A converter described by equation (6.25), equation (6.20), and equation (6...

    Please offer the Matlab code.Answer the question b.c.f.g. 5. (12.5%) The ideal D/A converter described by equation (6.25), equation (6.20), and equation (6.24) cannot be constructed because they require an infinite number of past and future samples of c(t) for the interpolation. However they can be approximated by using only a finite number of terms. Here we consider 2 methods Method I is to use only (N 1) terms of the sum in equation (6.25) as: sin IT(t nT)/T] T(t...

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