- Derive equations A*B = C
- Create symbolic variables, in your case :
Finding unknow of equation
4 次查看(过去 30 天)
显示 更早的评论
I have a A= 6*6 matrices with all known value, B=[0;0;x;0;0;y] and C=[a;b;0;c;d;-2000] and the relation is A*B=C. How can i get the unknown values of B &C?
0 个评论
回答(2 个)
Abderrahim. B
2022-11-16
Hi!
Matrix A is also unknown for us ^^ !
Workflow to find the unknowns is as follow:
syms x y a b c d
3. Declare the system of equations.
4. Solve System of Linear Equations Using solve
Hope this helps
0 个评论
John D'Errico
2022-11-16
I'll use syms here, because it displays things nicely.
syms x y a b c d
B=[0;0;x;0;0;y]
C=[a;b;0;c;d;-2000]
So B and C are VECTORS, not matrices. Now you have a matrix A, that is 6x6, and is completely known. As long as A is entirely known and is of full rank, you can use any number of ways to solve the problem.
For example, you could just use solve. But solve will often be slow. It is trivial to accomplish though. As an example, I need to have the matrix A, in numerical form.
A = randi(9,[6,6])
And now the solution using solve, for this particular matrix:
sol = solve(A*B == C,[a,b,c,d,x,y])
As easy, we can use equationsToMatrix to write the probmel in terms of linear algebra.
[S,T] = equationsToMatrix(A*B == C,[a,b,c,d,x,y])
So, for that particular matrix A, we now have two matrices, S and T that represnet the linear system. SOlve them, using backslash.
abcdxy = double(S)\double(T)
As you can see with format rat, the solution is the same.
format rat
abcdxy
Could we have done it differently yet? Yes. Move the unknowns to the left hand side, and move everything known to the right hand side. You will still have a system of linear equations. The result will be the same.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!