Mathematical formula calculation problem in Matlab
2 views (last 30 days)
Show older comments
I need to write above equation to my Matlab code but while writing it I got comfused. (M0=1.695) , (tetha1= 41.31 degree), and (gamma=1.4) . When I insert that numbers our result M1=2.5476. but it should be around 1.51. Would you please write that code in Matlab? I will insert my code also;
M1= sqrt((2.4^2*M0^4*(sind(t1)^2)-4*(M0^2*(sind(t1)^2)-1)*(1.4*M0^2*(sind(t1)^2)+1))/((2*1.4*M0^2*(sind(t1)^2)-2.4)*(0.4*M0^2*(sind(t1)^2)+2)));
0 Comments
Answers (1)
Simon Chan
on 12 Jul 2021
If you accept more than 1 line:
Gamma = 1.4;
M0 = 1.695;
theta1 = 41.31;
Msin = (M0*sind(theta1))^2;
Gplus = Gamma + 1;
Gminus = Gamma - 1;
nominator = (Gplus^2*Msin^2)-4*(Msin-1)*(Gamma*Msin+1);
denominator = (2*Gamma*Msin-Gplus)*(Gminus*Msin+2);
M1 = sqrt(nominator/denominator)
3 Comments
Simon Chan
on 12 Jul 2021
You are right, but I accidentally got what you want in my previous code.
Anyway, I got 2.5476 when change the nominator to the following:
nominator = (Gplus^2*M0^2*Msin)-4*(Msin-1)*(Gamma*Msin+1);
See Also
Categories
Find more on Gamma Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!