Blame view

mixer/mixer.py 659 Bytes
2ae5099ce   bmarechal   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  from sympy import *
  from sympy.simplify.fu import *
  
  init_printing()
  
  A, B, w, t, dphi = symbols('A, B, omega, t, Delta_phi', real=True, imaginary=False)
  
  #polynimial approach of RF mixer
  k1, k2, k3 = symbols('k1, k2, k3', real=True, imaginary=False)
  e = A*cos(w*t) + B*cos(w*t+dphi-pi/2)
  Vmix_poly = k1*e + k2*e**2
  Vmix_poly = expand(TR8(TR7(expand(Vmix_poly))))
  
  print('Polynomial result :
  ' + pretty(Vmix_poly) + '
  ')
  
  #product approach of RF mixer
  kphi = symbols('k_phi', real=True, imaginary=False)
  Vmix_prod = 2 * kphi * A*cos(w*t) * B*cos(w*t+dphi-pi/2)
  Vmix_prod = expand(TR8(TR7(expand(Vmix_prod))))
  print('Product result :
  ' + pretty(Vmix_prod))