Finding coefficients and bias term for equation y = (x-B)*A

4 Ansichten (letzte 30 Tage)
CM Sahu
CM Sahu am 18 Dez. 2023
Bearbeitet: CM Sahu am 18 Dez. 2023
This is my equation;
Y= (X-B)*A ----------(1) ,
moving RHS side to LHS it will become
Y-(X-B)*A = 0 ----------(2)
Y is 1*3 matrix, A is 3*3 matrix, X is 1*3 matrix, B is 1*3 matrix. expressed as
Y = [Yx Yy Yz];
X = [Xx Xy Xz];
I have Y and X values i want to calulate A,B that is
A = [A11 A12 A13; A21 A22 A23; A31 A32 A33];
B = [b1 b2 b3];
Suppose I have 1000 different values in a 1*3 matrix of X and Y. And for these values, I want to calculate a single value of A and B so that equation (2) is satisfied. you may take some coefficiant values zero.......
how should i calculate this please help........
Thank you in advance................
  3 Kommentare
CM Sahu
CM Sahu am 18 Dez. 2023
Bearbeitet: CM Sahu am 18 Dez. 2023
Yes , Value of A, and B for which equation
Y-(X-B)*A ------- is minimum, or equal to zero
John D'Errico
John D'Errico am 18 Dez. 2023
Bearbeitet: John D'Errico am 18 Dez. 2023
Your question has no answer. In fact, there are multiple flaws with your request.
First, MINIMUM? Minimum implies minus infinity is your goal. And since that is a matrix equation, your question has no meaning. Perhaps you mean something like the norm of the result is minimum, so as close to zero as possible. That has more of an answer, but still a serious flaw.
I would also add that you have posed TWO distinct equations. So, in the subject, you say Y=A*X+B. But in your question, you have several places said Y=(X-B)*A. Which is it? Should we guess? However, the shape of your vectors and the matrices would make the form Y=A*X+B meaningless, since the matrix-vector products will not conform. So I can assume the subject heading is simply wrong.
Next, even assuming answers to the abouve relatively minor points, there is still the impossible question to answer, in that your question has no answer, or that is has infinitely many answers, all of which are different but none are any better than the rest.
You have given 3 pieces of information, so effectively 3 data points. But you want to solve for 9 coefficients. And that is impossible to do in any unique way.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

John D'Errico
John D'Errico am 18 Dez. 2023
Bearbeitet: John D'Errico am 18 Dez. 2023
As my comment stated, this question is impossible to answer in any meaningful way. That is, given 1x3 vectors X and Y, can you find a 3x3 matrix A and a 1x3 vector B, such that
Y = (X-B)*A
is as close to all zeros as possible. Effectively, you are probably asking to solve for A and B such that norm(Y-(X-B)*A) is as close to zero as possible. Anything else is meaningless.
Given that, can we solve trivially for a 3x3 matrix and a vector B? Well, yes. But even this is meaningless, as there are infinitely many solutions, all of which are EXACT. For example, I'll pick some random numbers for X and Y.
format long g
X = randn(1,3)
X = 1×3
1.00388638995749 0.793938952531015 0.134784794053406
Y = randn(1,3)
Y = 1×3
0.260126076665028 -0.385813067387882 -1.41659412609083
Now I'll choose B as the all zero vector. We don't need B at all.
B = zeros(1,3)
B = 1×3
0 0 0
FInally, A is given simply as
A = (X-B)\Y
A = 3×3
0.259119039033931 -0.38431945212866 -1.41111000234878 0 0 0 0 0 0
Does it work? Yes. Trivially.
(X-B)*A
ans = 1×3
0.260126076665028 -0.385813067387882 -1.41659412609083
As you should see, this is exactly the value of the vector Y, so the difference will be identically zero. Actually, the difference may possibly be floating point trash, so a number on the order of eps.
norm(Y - (X-B)*A)
ans =
0
In this case, it was exactly zero, so I got lucky.
But there are infinitely many other solutions that we could have chosen, that would have been equally good. You should notice that A was mostly zeros itself. We don't even need 6 of the 9 unknown coefficients in A. And B was chosen in advance as all zeros. That should tell you how trivial and useless is this solution.
The real problem here is that you misunderstand something about matrices and linear algebra, even to ask this question. We can't know why you have posed this question, or what you were hoping it would solve.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by