Question: and 2 2 is given by the formula: = | 2 2 - x N 2 2 | Note the vertical bars indicate an absolute

and 22 is given by the formula:
=|22-xN22|
Note the vertical bars indicate an absolute value. Write a function called sqrt2approx that takes some user-specified value of the relative error threshold as the single input and determines the numirer of terms required to converge to this error. Your Matlab function should:
Use a while loop to generate sequence terms until the relative error, , is less than or equal to the user-specific error tolerance. Note that the userspecified error tolerance is the input to the function, not something to be defined within the function.
The first output of your function should be the value of the the last term generated.
The second output of your function should be the number of terms needed to meet the specified error tolerance.
Your function should also break the while loop if the number of terms needed to converge to the user-specified error tolerance exceeds 10(this sequence converges really fast, hence the small upper limit on the number of terms). When this happens, set both the first and second output of the function to 0.
and 2 2 is given by the formula: = | 2 2 - x N 2

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 Programming Questions!