我在用工具.py库(https://github.com/morriswmz/doatools.py) 现在,我的代码看起来像:
import numpy as np
from scipy import constants as const
import math
import doatools.model as model
import doatools.estimation as estimation
def calculate_wavelength(frequency):
return const.speed_of_light / frequency
# Uniform circular array
# X
# |
# X---------X
# |
# X
NUMBER_OF_ELEMENTS = 4 # elements are shown as "X"
RADIUS = 0.47 / 2
FREQ_MHZ = 315
freq = FREQ_MHZ * const.mega
wavelength = calculate_wavelength(freq)
antenna_array = model.UniformCircularArray(NUMBER_OF_ELEMENTS, RADIUS)
# Create a MUSIC-based estimator.
grid = estimation.FarField1DSearchGrid()
estimator = estimation.MUSIC(antenna_array, wavelength, grid)
R = np.array([[1.5, 2, 3, 4], [4, 5, 6, 5], [45, 5, 5, 6], [5, 1, 0, 5]])
_, estimates = estimator.estimate(R, 1, return_spectrum=False, refine_estimates=True)
print('Estimates: {0}'.format(estimates.locations))
我可以用这个库生成信号,但是我自己怎么用呢?例如,来自ADC的信号(如下所示:
-> Switching to antenna 0 : [0, 4, 7, 10]
-> Switching to antenna 1 : [5, 6, 11, 83]
-> Switching to antenna 2 : [0, 23, 2, 34]
-> Switching to antenna 3 : [23, 105, 98, 200]
()
我认为你的问题是你应该如何从天线中获取真实的数据,对吗? 假设你的数据应该是有序的。我的意思是在“天线0:[0,4,7,10]”的情况下,0是数据中的第一个,4,7是顺序,10是时间上的最后一个。 如果是,您可以将它们作为一个简单的矩阵,如您在上面键入的:
R=R与其厄米矩阵(python中的R.h)的乘积。你知道吗
R=R@R.h
这是协方差矩阵,作为函数的第一个参数。你知道吗
相关问题 更多 >
编程相关推荐