def AveBodeFromSpectra(specin): Gxxave=squeeze(specin.Gxx.mean(1)) Gxyave=squeeze(specin.Gxy.mean(1)) Gyyave=squeeze(specin.Gyy.mean(1)) Have=Gxyave/Gxxave cohnum=norm2(Gxyave) cohden=Gxxave*Gyyave mybode=rwkbode(input=specin.input, output=specin.output, \ compin=squeeze(Have), coh=squeeze(cohnum/cohden)) return mybode
def BodeFromSpectra(specin,calccoh=False): H=specin.Gxy/specin.Gxx if calccoh: cohnum=squeeze(norm2(specin.Gxy)) cohden=squeeze(specin.Gxx*specin.Gyy) coh=cohnum/cohden ave=True else: coh=[] ave=False mybode=rwkbode(input=specin.input, output=specin.output, \ compin=squeeze(H), coh=coh, averaged=ave) mybode.Gxx=specin.Gxx mybode.Gyy=specin.Gyy mybode.Gxy=specin.Gxy return mybode