educational course/tutorialoutlet.com educational course/tutorialoutlet.com | Page 109

ME 2016 Computing Techniques Section C - Spring 2017 Computing Project One Due Thursday , February 16th at 3:00pm Numerical Errors and Root-Finding Algorithms Please read all instructions ( on 2 pages ) before starting to write any code . Submission of your answers
• At the end of the class on 02 / 07 , upload any Matlab code that you have written on T-Square • By 3:00 pm on Thursday 02 / 16 , upload your final Matlab codes on T-Square . • At the start of the class on 02 / 16 , turn in the print-out of the codes , the print-out of the outputs of your code and the graph . Problem statement A shock wave , which is an extremely thin non-equilibrium region , is caused by the collision of fast moving gas with slower moving gas ( e . g ., the leading edge of a supersonic wing ). The following equation relates the dimensionless velocity inside the shock wave ϕ to the various parameters of the system : 1 − = [( 1 − ) 1 ( − 0 )] ( − ) where ξ is the dimensionless position inside the shock wave , 1 is the Mach number for the high velocity gas and α and β are constants . For = 0.32 and 1 = 2 , determine ϕ at the leading edge of the shock wave ( i . e . ξ = ξ0 ). Tasks 1 . Write the equation to be solved in the form f ( ϕ ) = 0 ( for the case ξ = ξ0 ). Plot the function f ( ϕ ) as a function of ϕ to get an idea of the value of the root ( you can only plot f for ϕ & gt ; 0.32 ). 2 . Write a function for the secant algorithm . The inputs should be the function f ( as an anonymous function handle ), the 1st initial guess x0 , the 2nd initial guess x1 , and the maximum allowable approximate percent relative error , . The outputs of the functions should be the value of the root , xr , the value of the approximate percent relative error , , and the