subject
Engineering, 21.02.2020 03:20 offensiveneedle

The "divide and average" method, an old-time method for approximating the square root of any positive number a, can be formulated as:

x= (x +a/x)/2

Write a well-structured M-file function based on the while...break loop structure to implement this algorithm. Use proper indentation so that the structure is clear. At each step estimate the error in your approximation as:

ε= |x^new- x^old/x^new|

Repeat the loop until ε is less than or equal to a specified value. Design your program so that it returns both the result and the error. Make sure that it can evaluate the square root of numbers that are equal to and less than zero. For the latter case, display the result as an imaginary number. For example, the square root of -4 would return 2i. Test your program by evaluating a = 0,2, 10 and-4 for ε = 10^-4

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Consider a large isothermal enclosure that is maintained at a uniform temperature of 2000 k. calculate the emissive power of the radiation that emerges from a small aperture on the enclosure surface. what is the wavelength ? , below which 10% of the emission is concentrated? what is the wavelength ? 2 above which 10% of the emission is concentrated? determine the wavelength at which maximum spectral emissive power occurs. what is the irradiation incident on a small object placed inside the enclosure?
Answers: 2
question
Engineering, 04.07.2019 19:10
Which of the following is the most important advantage of a large field of view? a. allows larger areas to be examined b. relieves eyestrain c. minimizes parallax errors. d. increases precision in proportion to the in- crease in field of view
Answers: 2
question
Engineering, 04.07.2019 19:10
Ahelical coil spring has a mean diameter of 50 mm, a wire diameter of 5.5 mm and is wound with a pitch of 10 mm. the spring steel has an ultimate strength of 1250 mpa. find the force needed to compress the spring solid and the wire stress in this condition. state whether the spring will return to its initial length.
Answers: 1
question
Engineering, 06.07.2019 02:30
In a unit cell of fcc structure, indicate the position of one of the tetrahedral interstitial sites by plotting the corresponding tetrahedron. do the same for one of the octahedral interstitial sites (in a separate fcc unit cell). mark the positions of all the tetrahedral and octahedral interstitial sites in the unit cells. how many equivalent tetrahedral sites and how many equivalent octahedral sites are contained in a fcc unit cell, respectively. what is the coordination number for a tetrahedral site and what is the coordination number for an octahedral site?
Answers: 2
You know the right answer?
The "divide and average" method, an old-time method for approximating the square root of any positiv...
Questions
question
Mathematics, 02.06.2021 23:20
question
English, 02.06.2021 23:20
Questions on the website: 13722361