matrix and system equation

7 次查看(过去 30 天)
Th
Th 2020-9-30
Can I convert matrix to system equation?If I want to input matrix A=[4 -4 0;2 3 5;3 5 7] X=[x1;x2;x3] B=[4;5;6]

回答(2 个)

Ameer Hamza
Ameer Hamza 2020-9-30
编辑:Ameer Hamza 2020-9-30
If you have the symbolic toolbox, then do it like this
A=[4 -4 0;2 3 5;3 5 7]; B=[4;5;6];
syms x [3 1]
eqs = A*x == B;
Result
>> eqs
eqs =
4*x1 - 4*x2 == 4
2*x1 + 3*x2 + 5*x3 == 5
3*x1 + 5*x2 + 7*x3 == 6
and If you just want to find the solution of x, then run
x = A\B;
Result
>> x
x =
-0.2000
-1.2000
1.8000
  7 个评论
Th
Th 2020-9-30
Please help me again.I try to code the program but it's error.
Ameer Hamza
Ameer Hamza 2020-9-30
编辑:Ameer Hamza 2020-9-30
There should be a space between variable name and size
syms x [q,1]
also, the recommended functional-based syntax is
x = sym('x', [3 1])

请先登录,再进行评论。


Th
Th 2020-9-30
Thank you so much!
  1 个评论
John D'Errico
John D'Errico 2020-9-30
Please don't use an answer to make a comment. Use comments for that purpose.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by