简体   繁体   English

如何在Matlab中找到矩阵方程的参数?

[英]how can I find the parameters of matrix-equation in matlab?

I have matrix equation below: 我有下面的矩阵方程式:

[M] = [A][R] + [B][L] 

where: A and B = 2 by 2 matrices 其中: AB = 2 x 2矩阵

M , R , L , and = 2 by 1 matrix. MRL和= 2 by 1矩阵。

To estimate one specific value of A and B , I have 9 different data of [M] , [R] , and [L] . 为了估计AB一个特定值,我有9个不同的数据[M][R][L] Let's say that these 9 data is one-group, and I have hundreds of group-data. 假设这9个数据是一组数据,而我有数百个组数据。

And I need to find the value of A and B related to specific group-data. 我需要找到与特定组数据相关的AB的值。

So does somebody have or know something with matlab of how to get the values of [A] and [B] for each group by just simply give input of [M] , [R] , and [L] data into matlab? 那么,是否有人通过简单地将[M][R][L]数据输入到matlab中,从而对matlab有所了解或知道如何获取每个组的[A][B]值?

I something is wrong with the way you have set up your problem. 我设置问题的方式有问题。 No matter what values M, R, and L have your equation is going to have an infinite number of solutions. 无论M,R和L的值是多少,您的方程式都将具有无限数量的解。

Regardless of the values of M, R, and L, one solution is [A] = [0], [B] = [0], [C] = [M]. 不管M,R和L的值如何,一个解都是[A] = [0],[B] = [0],[C] = [M]。 In fact if you set [C] = [M], then [A] and [B] can be any matrices for which [A][R] = [0] and [B][L] = [0], and there are an infinite number of those. 实际上,如果您设置[C] = [M],则[A]和[B]可以是[A] [R] = [0]和[B] [L] = [0]的任何矩阵,并且有无数个。

Post-Comments edit 评论后编辑

OK, I read your comment below a bit more carefully. 好的,我仔细阅读了您的评论。 I think the original way you stated your question is a bit misleading. 我认为您最初提出问题的方式有点误导。 In your new formulations you have 9 instances of 在您的新配方中,您有9个实例

Xm = a Xr + bYr + cXp + dYp Xm = a Xr + bYr + cXp + dYp

This is typically put in terms of a 9x4 matrix multiplying a four vector giving a 9 vector: 通常用9x4矩阵乘以四个向量得出9个向量来表示:

y = X b y = X b

Where y is a 9x1 vector containing your Xm, X is the 9x4 matrix containing your 9 rows of Xr, Yr, Xp, and Yp values, and b is the unknown we'd like to solve for. 其中y是包含Xm的9x1向量,X是包含9行Xr,Yr,Xp和Yp值的9x4矩阵,b是我们要解决的未知数。

If the all the equations are linearly independent the system is over-determined so you can't get an exact solution, only a best fit. 如果所有方程都是线性独立的,则系统是超定的,因此您无法获得精确的解决方案,而只能获得最佳拟合。 To do a linear least squares fit in Matlab the command is: 要在Matlab中进行线性最小二乘拟合,命令是:

b = X\y

b will be the 1x4 vector containing a, b, c, and d which is the least squares approximation to a solution. b是包含a,b,c和d的1x4向量,它是对解的最小二乘近似。 See this matlab reference . 请参阅此matlab参考

You can't matricies of different sizes. 您不能使用大小不同的矩阵。 This equation makes no sense to me. 这个方程对我来说毫无意义。

UPDATE: 更新:

This updated equation makes sense. 这个更新的公式很有意义。

It sounds like a least squares fitting problem. 听起来像是最小二乘拟合问题。 You're going to enter your data and get the best estimate you can for the coefficient matricies. 您将输入数据,并为系数矩阵获得最佳估计。 I'd have to know more about the exact nature of the data, groupings, etc., but I'd recommend that you start reading about MATLAB's least squares fitting capabilities. 我将不得不更多地了解数据,分组等的确切性质,但是我建议您开始阅读有关MATLAB最小二乘拟合功能的信息。

Least squares fitting starts by coming up with a model. 最小二乘拟合始于提出一个模型。 Let's assume you have three independent variables (x, y, z) and one dependent variable (v): 假设您有三个自变量(x,y,z)和一个因变量(v):

替代文字
(source: equationsheet.com ) (来源: equationsheet.com

You now have four coefficients you need to solve for. 现在,您需要解决四个系数。 You'll have n sets of points, where n > 4, so you'll need to do a least squares fit. 您将拥有n组点,其中n> 4,因此您需要进行最小二乘拟合。

If you substitute your points into the equation you'll end up with a matrix equation: 如果将点替换为方程式,最终将得到矩阵方程式:

替代文字

If you premultiply both sides by the transpose of 如果您将两边都乘以 替代文字 , you'll have a square matrix that you can invert and solve for the coefficients. ,您将拥有一个方矩阵,可以将其求逆并求解系数。

This formulation allows higher order polynomials as well. 该公式还允许更高阶的多项式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM