How can ı find intersection points of cp and cp_p_g on axis M?

Viewed 40
import numpy as np
import matplotlib.pyplot as plt 

Cp_0=-0.464   
M=np.arange(0.3,1,0.1) #Mach number for range<0.3-1>
Cp=(2/(1.4*M**2))*(((1+0.2*M**2)/(1.2))**3.5-1) #Aerodynamic relation for isentropic flow
Cp_p_g=Cp_0/((1-M**2)**0.5) #prandtl-Glauert rule

plt.plot(M,Cp)
plt.plot(M,Cp_p_g)
plt.grid("major")
plt.title('NACA**-***') #Title varies on the NACA profiles that we work
plt.xlabel("M")
plt.ylabel("Cp")

cp and cp_p_g curves

I have added a plot of two curves, cp and, cp_p_g, for better understanding of the problem

1 Answers

You can refine your x-meshgrid using linspace and then look for the difference of the two curves

M = np.linspace(0.3, 1, 200)

# Remaining code

idx = np.argmin(np.abs(Cp_p_g-Cp))

plt.axvline(M[idx], c='k', ls='--')
plt.axhline(Cp_p_g[idx], c='k', ls='--')

enter image description here

Related