1

我有一个物理测量仪器(带有称重传感器的力平台),它给了我三个值,A、B 和 C。但是,由于物理特性,这些值——应该是正交的——实际上是有些耦合的。测量设备,这会导致施加的力和扭矩的值与返回的值之间产生串扰。

然后,建议使用校准矩阵将测量值转换为对实际值的更好估计,如下所示:

在此处输入图像描述

问题是有必要执行一组测量,以便不同的measured(Fz, Mx, My)actual(Fz, Mx, My)最小二乘的以获得一些对整个系统最有效的 C 矩阵。

我可以解决ONE 测量的Ax = B问题scipy.linalg.lststq,甚至scipy.linalg.solve(给出一个精确的解决方案),但是我应该如何着手考虑一组不同的测量,每个测量都有自己的方程,给出一个可能不同的 3x3 矩阵?

非常感谢任何帮助,感谢您的阅读。

4

1 回答 1

1

我在 math.stackexchange.com 上发布了一个类似的问题,其中只包含数学部分,这个答案解决了这个问题:

math.stackexchange.com/a/232124/27435

如果将来有人遇到类似问题,这里是该答案的几乎字面的 Scipy 实现(第一行是初始化样板代码):

import numpy
import scipy.linalg

### Origin of the coordinate system: upper left corner!
"""
    1----------2
    |          |
    |          |
    4----------3
"""

platform_width = 600
platform_height = 400

# positions of each load cell (one per corner)
loadcell_positions = numpy.array([[0, 0],
                                  [platform_width, 0],
                                  [platform_width, platform_height],
                                  [0, platform_height]])

platform_origin = numpy.array([platform_width, platform_height]) * 0.5

# applying a known force at known positions and taking the measurements
measurements_per_axis = 5
total_load = 50

results = []
for x in numpy.linspace(0, platform_width, measurements_per_axis):
    for y in numpy.linspace(0, platform_height, measurements_per_axis):
        position = numpy.array([x,y])
        for loadpos in loadcell_positions:
            moments = platform_origin-loadpos * total_load
            load = numpy.array([total_load])
            result = numpy.hstack([load, moments])
            results.append(result)
results = numpy.array(results)
noise = numpy.random.rand(*results.shape) - 0.5
measurements = results + noise

# now expand ("stuff") the 3x3 matrix to get a linearly independent 3x3 matrix
expands = []
for n in xrange(measurements.shape[0]):
    k = results[n,:]
    m = measurements[n,:]

    expand = numpy.zeros((3,9))
    expand[0,0:3] = m
    expand[1,3:6] = m
    expand[2,6:9] = m
    expands.append(expand)
expands = numpy.vstack(expands)

# perform the actual regression
C = scipy.linalg.lstsq(expands, measurements.reshape((-1,1)))
C = numpy.array(C[0]).reshape((3,3))

# the result with pure noise (not actual coupling) should be
# very close to a 3x3 identity matrix (and is!)
print C

希望这对某人有帮助!

于 2012-11-08T15:46:23.533 回答