Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLease help me solve this matlab problem. Thank you Problem 2: Understanding of errors (using an example of the cosine series) See HW01 Pre-Lab Exercise
PLease help me solve this matlab problem. Thank you
Problem 2: Understanding of errors (using an example of the cosine series) See HW01 Pre-Lab Exercise 2 for reference The algorithm for the cosine Taylor series expansion is given as follows: 1. x X4 X6 (-1)*+1x(2k-2) cos(x) = 1- 16 2 (2k 2)! a) Create a user defined function to approximate the value of cosine using the provided algorithm using a while loop to ensure that the algorithm runs until the percent error is below a given error tolerance (maxtol). A partially completed code has been provided (remove the part from the function handle before running). b) Test the function created in part (a) by evaluating at x = 7 and maxtol = le-4. c) Modify (slightly) the MATLAB function cosine_taylorN so that the while-loop checks both the error tolerance and the maximum number of iterations (maxitr). In other words, the loop terminates when either the error is sufficiently small or the maximum number of iterations is exceeded. The required inputs and outputs for the function are given below. function [y,N] = cosine_taylorN(x, maxtol, maxitr) d) Test the function again by evaluating at x = 7, maxtol = le-4, and maxitr = 20. What happens if maxitr = 10Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started