The natural logarithm of a number x>(1)/(2) can be approximated by the series
ln(x)~~sum_(n=1)^N ((x-1)^(n))/(nx^(n))
Write a Matlab function myLog that takes as input x and the number N and outputs as y the estimate of ln(x) using Eq. (1) and the corresponding true relative error tre. For the true value of ln(x) use Matlab's build-in function log(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)/(2), 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.
The natural logarithm of a number >1/2 can be approximated by the series
(1)
n.xn n=1
Write a Matlab function myLog that takes as input x and the number N and outputs as y the estimate of In using Eq.(1 and the corresponding true relative error t re.For the true value of ln(use Matlab's build-in function logx 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 < l/2,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.