Advanced Mathematical Methods for Engineers.
The inverse tangent of a number x > 1 can be approximated by the series
tan-1(x) ≈ + NX(-1)n+1. (1)π 2
n =0
(2n + 1)x2n+1 Write a Matlab function myAtan that takes as input x and the number N and outputs as y the estimate of tan-1(x) using Eq. (1) and the corresponding true relative error tre. For the true value of tan-1(x) use Matlab’s build-in function atan(x) here and in the following problems. Code the function such that it can handle both scalar and column vector inputs for x, resulting in scalar, respective column vector outputs for y and tre. If any of the values for x are x ≤ 1, i.e., Eq. (1) is not applicable, call Matlab’s error function and output an appropriate error message. Do not print any results to screen or do any plotting within the function.
10 months ago
Purchase the answer to view it

- q2exam1.png