mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 11:33:32 +01:00
ZH: Allow the beacon's signal to decrease with distance
This commit is contained in:
parent
165a7c0361
commit
0966be97b9
1 changed files with 8 additions and 5 deletions
|
@ -5,8 +5,8 @@ import numpy as np
|
||||||
|
|
||||||
from earsim import Antenna
|
from earsim import Antenna
|
||||||
|
|
||||||
def sine_beacon(f, t, t0=0, amplitude=1):
|
def sine_beacon(f, t, t0=0, amplitude=1, baseline=0):
|
||||||
return amplitude * np.sin(2*np.pi*f*(t-t0))
|
return amplitude * np.sin(2*np.pi*f*(t-t0)) + baseline
|
||||||
|
|
||||||
|
|
||||||
def distance(x1, x2):
|
def distance(x1, x2):
|
||||||
|
@ -22,8 +22,11 @@ def distance(x1, x2):
|
||||||
|
|
||||||
return np.sqrt( np.sum( (x1-x2)**2 ) )
|
return np.sqrt( np.sum( (x1-x2)**2 ) )
|
||||||
|
|
||||||
def beacon_from(tx, rx, f, t=0, t0=0, c_light=3e8, **kwargs):
|
def beacon_from(tx, rx, f, t=0, t0=0, c_light=3e8, radiate_rsq=True, amplitude=1,**kwargs):
|
||||||
dist = distance(tx,rx)/c_light
|
dist = distance(tx,rx)
|
||||||
t0 = t0 + dist/c_light
|
t0 = t0 + dist/c_light
|
||||||
|
|
||||||
return sine_beacon(f, t, t0=t0, **kwargs)
|
if radiate_rsq:
|
||||||
|
amplitude *= 1/(dist**2)
|
||||||
|
|
||||||
|
return sine_beacon(f, t, t0=t0, amplitude=amplitude,**kwargs)
|
||||||
|
|
Loading…
Reference in a new issue