Solving Matrices with Symbolic Variables

조회 수: 237 (최근 30일)
Jared
Jared 2011년 11월 30일
댓글: Dyuman Joshi 2023년 11월 13일
I am trying to figure out how to solve a problem such as [A]{X}={0} where [A] is a numerical matrix such as
[1 2 3 4]
[5 6 7 8]
[9 0 1 2]
and {X} is a symbolic matrix with a single numeric value such as
[1x1 sym; 1x1 sym; 1x1 sym; 1]
that is:
[a]
[b]
[c]
[1]
Is there a way to find a,b,c such that [A]{X}={0}
  댓글 수: 2
Shivam Prajapati
Shivam Prajapati 2020년 6월 2일
null(A)
Walter Roberson
Walter Roberson 2020년 6월 2일
null() by itself does not work for the case where one or more of the X vectors are known constants, as is required by the Question.

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 11월 30일
A =[ 1 2 3 4
5 6 7 8
9 0 1 2]
syms a b c
x = [a;b;c]
k = A(:,1:3)\-A(:,end);
for i1 = 1 : numel(x)
eval([char(x(i1)),'=k(i1)']);
end
  댓글 수: 3
Karan Gill
Karan Gill 2016년 12월 1일
It's much simpler. See Kaixiang Wang's answer below.
JITHA K R
JITHA K R 2018년 1월 4일
Can you explain the working of this code pls?

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Kaixiang Wang
Kaixiang Wang 2016년 11월 30일
편집: Kaixiang Wang 2016년 11월 30일
Simply use MATLAB symbolic toolbox and the solve() function.
syms a b c
A=[1 2 3 4;5 6 7 8;9 0 1 2]
X=[a;b;c;1]
sol=solve(A*X)
  댓글 수: 2
Shivam Prajapati
Shivam Prajapati 2020년 6월 2일
Null(A) % null is matlab command
Walter Roberson
Walter Roberson 2020년 6월 2일
null() by itself does not work for the case where one or more of the X vectors are known constants, as is required by the Question.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2011년 11월 30일
편집: John Kelly 2014년 5월 27일
Linear algebra with symbolic matrices is discussed at http://www.mathworks.com/products/symbolic/
  댓글 수: 3
Walter Roberson
Walter Roberson 2023년 11월 13일
In particular these days, that page leads to https://www.mathworks.com/help/symbolic/linear-algebra.html
Dyuman Joshi
Dyuman Joshi 2023년 11월 13일
@Charles, Why exactly do you want to that?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by