You are on page 1of 1

MATLAB Command Window Page 1

>> clear all


syms theta M;gamma=1.4;
mu=asin(1/M);
k1=(tan(mu))^2;
k2=((gamma-1)/2+(gamma+1)*k1/2)*tan(abs(theta)*pi/180);
k3=((gamma+1)/2+(gamma+3)*k1/2)*tan(abs(theta)*pi/180);
k4=sqrt(4*(1-3*k2*k3)^3/((27*k2^2*k1+9*k2*k3-2)^2)-1);
beta=atan((k3+9*k2*k1)/(2*(1-3*k2*k3))-(k4*(27*k2^2*k1+9*k2*k3-2))/(6*k2*(1-3*k2*k3))*tan
(0*pi/3+1/3*atan(1/k4)))*180/pi; %%Wave angle formula
j=1;
for i=2:0.2:20
m_ary(j)=i;
beta_ary(j)=vpa(subs(beta,[M theta],[i 20])); %%Wave angle claculation
beta_plot(j)=beta_ary(j)-20;
Mn_ary(j)=vpa(i*sin(beta_ary(j)*pi/180));
Pratio_ary(j)=vpa(1+((7/6)*((Mn_ary(j)^2)-1))); %%Pressure ratio calculation
Tratio_ary(j)=vpa((1+(((2*gamma)/(gamma+1))*(Mn_ary(j)^2-1)))*((2+((gamma-1)
*Mn_ary(j)^2))/((gamma+1)*Mn_ary(j)^2))); %%Temperature ratio calculation
RHOratio_ary(j)=vpa(((gamma+1)*Mn_ary(j)*Mn_ary(j))/(2+((gamma-1)*Mn_ary(j)*Mn_ary
(j)))); %%Density ratio calculation
j=j+1;
end
figure
plot(m_ary(:),beta_plot(:),'LineWidth',2)
p=title('\beta - \theta -vs- Free Stream Mach No.');
p.FontSize=11;
grid on
xlabel('Free-stream Mach No.')
ylabel('\beta - \theta (degrees)')
figure
plot(m_ary(:),Pratio_ary(:),'LineWidth',2)
hold on
plot(m_ary(:),Tratio_ary(:),'LineWidth',2)
hold on
plot(m_ary(:),RHOratio_ary(:),'LineWidth',2)
grid on
p=title('P, T, \rho ratios -vs- Free Stream Mach No.');
p.FontSize=11;
ylabel('Ratios of properties')
xlabel('Free-stream Mach No.')
legend('Static Pressure Ratios','Static Temperature Ratios','Static Density
Ratios','location','northwest')
>>

You might also like