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'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('Free stream Mach number='); theta_c = input('cone angle in degree='); theta_s = input('initial guess for shock angle in degree='); while (Vtheta0 <= -tol) || (Vtheta0 >= tol) % checking the correct input for beta if (theta_s <= asind(1/M1)) theta_c = 0.0; Mc = M1; disp(' !!!!! theta_s > theta_s_max !!!!! '); 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 (
Expert's answer

Not answered

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal