Mathematical formula calculation problem in Matlab
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/681828/image.png)
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 commentaires
Réponses (1)
Simon Chan
le 12 Juil 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 commentaires
Simon Chan
le 12 Juil 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);
Voir également
Catégories
En savoir plus sur Gamma Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!