IQ.py 368 Bytes
from sympy import *
from sympy.simplify.fu import *

init_printing()

#constants
E0, E1, W, t, dphi, kphi = symbols('E0, E1, Omega, t, Delta_phi, k_phi', real=True, imaginary=False)

#define LO and RF
LO_I = E0*cos(W*t)
LO_Q = E0*cos(W*t+pi/2)
RF = E1*cos(W*t+dphi)

#mixer
IF_I = 2*kphi*LO_I*RF
IF_I = expand(TR8(IF_I))
IF_Q = 2*kphi*LO_Q*RF
IF_Q = expand(TR8(IF_Q))