Mathematical formula calculation problem in Matlab
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Simon Chan
2021-7-12
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 个评论
Simon Chan
2021-7-12
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);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gamma Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!