import math import cmath fc=716 # fréquence caractéristique a=5 # facteur amortissement inf=15.625 # fréquence inférieure sup=32000 # fréquence supérieure N=264 # nombre de points, 24 par octave offset=80 # décalage en dB file_low=open("low_Duelund.frd","w") # nom des fichiers .frd file_mid_low=open("mid_low_Duelund.frd","w") file_mid_high=open("mid_high_Duelund.frd","w") file_high=open("high_Duelund.frd","w") for i in range(0,N+1): f=inf*(sup/inf)**(i/N) #balayage fréquentiel s=1j*f/fc low=1/((1+a*s+s**2)**4*(1+s)**2) # fonctions de transfert mid_a=low*(3-2*a**2)*s**2 mid_b=low*(2-2*a**2+a**4)*s**4 mid_c=low*(-2+2*a**2-a**4)*s**6 mid_d=low*(-3+2*a**2)*s**8 mid_low=mid_a+mid_b mid_high=mid_c+mid_d high=-low*s**10 file_low.write(str(f)) file_low.write("\t") file_low.write(str(20*math.log10(abs(low))+offset)) file_low.write("\t") file_low.write(str(57.29*cmath.phase(low))) file_low.write("\n") file_mid_low.write(str(f)) file_mid_low.write("\t") file_mid_low.write(str(20*math.log10(abs(mid_low))+offset)) file_mid_low.write("\t") file_mid_low.write(str(57.29*cmath.phase(mid_low))) file_mid_low.write("\n") file_mid_high.write(str(f)) file_mid_high.write("\t") file_mid_high.write(str(20*math.log10(abs(mid_high))+offset)) file_mid_high.write("\t") file_mid_high.write(str(57.29*cmath.phase(mid_high))) file_mid_high.write("\n") file_high.write(str(f)) file_high.write("\t") file_high.write(str(20*math.log10(abs(high))+offset)) file_high.write("\t") file_high.write(str(57.29*cmath.phase(high))) file_high.write("\n") file_low.close() file_mid_low.close() file_mid_high.close() file_high.close()