简体   繁体   中英

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

M , R , L , and = 2 by 1 matrix.

To estimate one specific value of A and B , I have 9 different data of [M] , [R] , and [L] . Let's say that these 9 data is one-group, and I have hundreds of group-data.

And I need to find the value of A and B related to specific group-data.

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?

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.

Regardless of the values of M, R, and L, one solution is [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.

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

Xm = a Xr + bYr + cXp + dYp

This is typically put in terms of a 9x4 matrix multiplying a four vector giving a 9 vector:

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.

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:

b = X\y

b will be the 1x4 vector containing a, b, c, and d which is the least squares approximation to a solution. See this matlab reference .

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.

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):

替代文字
(source: 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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