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
Atmospheric air has a temperature (dry bulb) of 80° f and a wet bulb temperature of 60° f when the barometric pressure is 14.696 psia. determine the specific humidity, grains/lb dry air. a. 11.4 c. 55.8 d. 22.5 b. 44.1
Answers: 1
question
Engineering, 04.07.2019 18:10
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
Answers: 2
question
Engineering, 04.07.2019 18:20
Acertain flow of air (at stp) has a velocity distribution given by v i (in ft/s). if this flow is going through a 4 ft square area in the yz-plane (centered at the origin), what is the mass flow rate (in lbm/s)?
Answers: 2
question
Engineering, 04.07.2019 18:20
Prove the equivalence between the two statements of the 2nd law of thermodynamics (i.e., a violation of one statement leads to the violatio the other statement)
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
Social Studies, 30.11.2021 23:30
Questions on the website: 13722361