def estimate_range(tx,rx,fs,quiet=False):
"""
tx: the known, noise-free, undelayed transmit signal (bistatic radars agree beforehand on the psuedorandom sequence)
rx: the noisy, corrupted, interference, jammed signal to estimate distance from
fs: baseband sample frequency
"""
Rxy = np.correlate(tx, rx, 'full')
lags = np.arange(Rxy.size) - Rxy.size // 2
pklag = lags[Rxy.argmax()]
distest_m = -pklag / fs / 2 * c
mR = abs(Rxy) # magnitude of complex cross-correlation
if not quiet and figure is not None:
ax = figure().gca()
ax.plot(lags,mR)
ax.plot(pklag,mR[mR.argmax()], color='red', marker='*')
ax.set_title('cross-correlation of receive waveform with transmit waveform')
ax.set_ylabel('$|R_{xy}|$')
ax.set_xlabel('lags')
ax.set_xlim(pklag-100,pklag+100)
return distest_m
评论列表
文章目录