Question: Write MATLAB Live Script code ( . mlx file ) to estimate l n ( x ) for a user inputted value of x using

Write MATLAB Live Script code (.mlx file) to estimate ln(x) for a user inputted value of x using the series expansion:
ln(x)=n=11n(x-1x)n=(x-1x)+12(x-1x)2+13(x-1x)3+dots valid for x>12
Note: the natural log function in MATLAB is log.
Use a for loop to calculate the series. The maximum value of n in the equation above should be a user inputted value of N(in other words, instead of calculating the infinite series, the user can specify the number of terms so that n goes from 1 to N).
The user should be prompted to enter the value of x. If the value entered is not within the valid range the user should be prompted again for a new value of x.
The user should be prompted to enter the value of N.
Your code should output the estimated value of ln(x) from the series calculation and the difference between it and the value MATLAB calculates as log(x). Be sure to label what each of the two values are in your output.
Use fprintf statements to have each value display using fixed-point notation with a field width of 8 and 6 digits after the decimal place. Use x=1.5 and N=5 to run your code.
Write a new MATLAB Live Script code (.mIx file) to perform the same calculation but this time use a while loop to calculate for as many terms as it takes to have the difference between the series estimate and the actual value of ln(x) to be less than or equal to 0.00001. Also output the number of iterations it took to meet this tolerance. Test your code for x=1.5.(Note: you can copy the code from Part 1 into a new file and edit your code).
 Write MATLAB Live Script code (.mlx file) to estimate ln(x) for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!