# Answer to Question #42269 in MatLAB | Mathematica | MathCAD | Maple for Majid

Question #42269
hi: I wrote a code to solve an ODE using Runge-Kutta 4th order, but unfortunately it doesn&#039;t work properly. i need your help please: clc; clear all; % initial values gamma = 1.4; P1 = 101325; % Pa T1 = 298; % K Rho1 = 1.225; % kg/m3 tol = -(1e-6); % convergence criteria for Vtheta Vtheta0 = -10; % fake value to initiate the while loop delta_theta = 0.5; % angle marching % inputs M1 = input(&#039;Free stream Mach number=&#039;); theta_c = input(&#039;cone angle in degree=&#039;); theta_s = input(&#039;initial guess for shock angle in degree=&#039;); while (Vtheta0 &lt;= -tol) || (Vtheta0 &gt;= tol) % checking the correct input for beta if (theta_s &lt;= asind(1/M1)) theta_c = 0.0; Mc = M1; disp(&#039; !!!!! theta_s &gt; theta_s_max !!!!! &#039;); return; end % calculating the parametrs before shock Mn1 = M1 * sind (theta_s); Mu1 = M1 * cosd (theta_s); P2 = P1 * (1 + (2 * gamma * (Mn1 ^ 2 - 1) / (gamma + 1))); Rho2 = Rho1 * ((gamma + 1) * Mn1 ^ 2 / (2+((gamma - 1) * Mu1 ^ 2))); T2 = T1 * P2 * Rho1 / (P1 * Rho2); theta = atand (

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!