Problem 2 (25 points) (CCO 3)/MatlabGrader Develop a Matlab function that finds a root of a function g(x) starting from the given initial estimates x (-1) and x (0) with a tolerance in function of at least OK using the secant method. Name the function mySecant using as input the anonymous function g, the initial estimates x00 and x0, the maximum number of iterations to perform N, and the required tolerance in function epsok. As output, the function shall return four scalar variables: the numerical solution x, its tolerance in function tolFunc, its estimated relative error ere, and the number of iterations performed n. If the requested tolerance in function cannot be reached within N iterations, the function shall execute Matlab's error("...") function with an appropriate error message. Other than this potential error message, do not print out any results to screen or do any plotting within the function. You must minimize the number of function calls g(x) required per iteration, by storing function call results in temporary storage variables. You may use only 1 function call to g to update the solution per iteration. Required submission: ☐ well commented function source code submitted to Matlab Grader using the Canvas link for Exam 3 - Problem 2
Problem 2 (25 points) (CCO 3)/MatlabGrader Develop a Matlab function that finds a root of a function g(x) starting from the given initial estimates x (-1) and x (0) with a tolerance in function of at least OK using the secant method. Name the function mySecant using as input the anonymous function g, the initial estimates x00 and x0, the maximum number of iterations to perform N, and the required tolerance in function epsok. As output, the function shall return four scalar variables: the numerical solution x, its tolerance in function tolFunc, its estimated relative error ere, and the number of iterations performed n. If the requested tolerance in function cannot be reached within N iterations, the function shall execute Matlab's error("...") function with an appropriate error message. Other than this potential error message, do not print out any results to screen or do any plotting within the function. You must minimize the number of function calls g(x) required per iteration, by storing function call results in temporary storage variables. You may use only 1 function call to g to update the solution per iteration. Required submission: ☐ well commented function source code submitted to Matlab Grader using the Canvas link for Exam 3 - Problem 2
Elements Of Electromagnetics
7th Edition
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Sadiku, Matthew N. O.
ChapterMA: Math Assessment
Section: Chapter Questions
Problem 1.1MA
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Control Systems Engineering
Mechanical Engineering
ISBN:
9781118170519
Author:
Norman S. Nise
Publisher:
WILEY
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:
9781337093347
Author:
Barry J. Goodno, James M. Gere
Publisher:
Cengage Learning
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:
9781118807330
Author:
James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:
WILEY