def plotResponseFEM(Ax,fi,f,H,Comp):
FS = 20
xTicks = (np.logspace(np.log(np.min(f)),np.log(np.max(f)),9))
Ylim = np.array([np.min(np.real(H)),np.max(np.real(H))])
Ax.grid('both', linestyle='-', linewidth=0.8, color=[0.8, 0.8, 0.8])
Ax.semilogx(f,0*f,color='k',linewidth=2)
Ax.semilogx(f,np.real(H),color='k',linewidth=4,label="Real")
Ax.semilogx(f,np.imag(H),color='k',linewidth=4,ls='--',label="Imaginary")
Ax.semilogx(np.array([fi,fi]),1.1*Ylim,linewidth=3,color='r')
Ax.set_xbound(np.min(f),np.max(f))
Ax.set_ybound(1.1*Ylim)
Ax.set_xlabel('Frequency [Hz]',fontsize=FS+2)
Ax.tick_params(labelsize=FS-2)
Ax.yaxis.set_major_formatter(FormatStrFormatter('%.1e'))
if Comp == 'x':
Ax.set_ylabel('$\mathbf{Hx}$ [A/m]',fontsize=FS+4,labelpad=-5)
Ax.set_title('$\mathbf{Hx}$ Response at $\mathbf{Rx}$',fontsize=FS+6)
elif Comp == 'y':
Ax.set_ylabel('$\mathbf{Hy}$ [A/m]',fontsize=FS+4,labelpad=-5)
Ax.set_title('$\mathbf{Hy}$ Response at $\mathbf{Rx}$',fontsize=FS+6)
elif Comp == 'z':
Ax.set_ylabel('$\mathbf{Hz}$ [A/m]',fontsize=FS+4,labelpad=-5)
Ax.set_title('$\mathbf{Hz}$ Response at $\mathbf{Rx}$',fontsize=FS+6)
elif Comp == 'abs':
Ax.set_ylabel('$\mathbf{|H|}$ [A/m]',fontsize=FS+4,labelpad=-5)
Ax.set_title('$\mathbf{|H|}$ Response at $\mathbf{Rx}$',fontsize=FS+6)
if np.max(np.real(H[-1])) > 0.:
handles, labels = Ax.get_legend_handles_labels()
Ax.legend(handles, labels, loc='upper left', fontsize=FS)
elif np.max(np.real(H[-1])) < 0.:
handles, labels = Ax.get_legend_handles_labels()
Ax.legend(handles, labels, loc='lower left', fontsize=FS)
return Ax
评论列表
文章目录