Effacer les filtres
Effacer les filtres

Mathematical formula calculation problem in Matlab

2 vues (au cours des 30 derniers jours)
Ahmet Akcura
Ahmet Akcura le 12 Juil 2021
Commenté : Simon Chan le 12 Juil 2021
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)));

Réponses (1)

Simon Chan
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
Ahmet Akcura
Ahmet Akcura le 12 Juil 2021
nominator = (Gplus^2*Msin^2)-4*(Msin-1)*(Gamma*Msin+1);
in above part 'Msin^2' please control this term. Not true. When I write like you with arranging correctly, it gave me the M1=2.54 again.
Simon Chan
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);

Connectez-vous pour commenter.

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!

Translated by