Blame view

doppler/doppler.py 435 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
  from sympy import *
  from sympy.simplify.fu import *
  
  init_printing()
  
  #constants
  A, B, w, t, kphi, c = symbols('A, B, omega, t, k_phi, c', imaginary=False, real=True)
  dx = symbols('delta_x', cls=Function)
  #wave vector
  k = w/c
  
  #reflected wave
  E1 = A*cos(w*t-2*k*dx(t))
  
  #demodulation of E1 at omega in quadrature
  E2 = B*cos(w*t-pi/2)
  Vmix = 2 * kphi * E1 * E2
  Vmix = expand(TR8(TR7(expand(Vmix))))
  print('V_mixer = 
  ' + pretty(Vmix))