Question

# SOLVE USING MATLAB The following implicit equation offers a way to estimate the critical free stream...

SOLVE USING MATLAB The following implicit equation offers a way to estimate the critical free stream velocity M_cr (Mach number) at which one can expect to observe a sonic flow (M=1) at a certain point on an airfoil. Solve the following implicit equation for M_cr when C_p.0=-0.43 and γ=1.4 (Use iteration or Newton's Method to solve the implicit equation). Avoid using symbolic toolbox servers.

Cp,0 / √(1-M2cr) = 2/(γM2cr) { [(2+(γ-1) M2cr) / (γ+1)] ^ (γ / ((γ-1))) -1}

PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU

Output:

Code:

``````%Newton Ralphson to find M

clc

clear

C_p0 = -0.43;

g = 1.4; % g = gamma

syms M % M = critical free stream velocity

f1(M) = C_p0/sqrt(1-M^2) - (2/(g*M^2))*(((2+(g-1)*M^2)/(g+1))^(g/(g-1))-1);

fd = diff(f1);

p0 = 0.5; % initial approximation

n = 100; % maximum number of iterations

tol = 0.001; % tolerance required

i=1;

while i <= n

p = p0 - (f1(p0)/fd(p0)); %Newton-Raphson method

if (abs(p - p0)/abs(p)) < tol %stopping criterion when difference between iterations is below tolerance

fprintf('Solution is %f \n', double(p))

return

end

i = i + 1;

p0 = p; %update p0

end``````