How to solve the AX=0, When some of the elements in matrix X is known.

조회 수: 15 (최근 30일)
JITHA K R
JITHA K R 2018년 1월 11일
댓글: Luke Pretzie 2019년 9월 2일
I have to solve for X. Equation is AX=0. A MATRIX is a square matrix and in X matrix some of the elements are known some are unknowns. I want to get the unknowns. Can someone help me?

채택된 답변

Birdman
Birdman 2018년 1월 11일
편집: Birdman 2018년 1월 11일
One approach is symbolical(requires Symbolic Toolbox).
A=[1 2 3;4 5 6;7 8 9];%dummy data
syms x1 x2
X=[x1;x2;1];
eq=A*X==0;
solx=solve(eq);
x1=solx.x1
x2=solx.x2
  댓글 수: 4
JITHA K R
JITHA K R 2018년 1월 11일
How will I specify matrix X with some known values and other unknown values as symbolic variables.?
Birdman
Birdman 2018년 1월 11일
a=randi([1 10],18,1);%known dummy data
X=[x;a]

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

추가 답변 (1개)

Fadhel Alsaffar
Fadhel Alsaffar 2019년 2월 3일
I tried the code above with my matrix but it did not work
A=[0.6485 -1 0;-1 2.4728 -2;0 -2 4.2970];%dummy data
syms x1 x2
X=[x1;x2;1];
eq=A*X==0;
solx=solve(eq);
x1=solx.x1
x2=solx.x2
Do you know what the problem with my code?
  댓글 수: 1
Luke Pretzie
Luke Pretzie 2019년 9월 2일
Did your code give you an error message? Or did it show no output, or it showed x1 and x2 as "structs"? You can convert your structs to floats using the double() function:
x1 = double(solx.x1)
x2 = double(solx.x2)
That's assuming, of course, that everyone else went right and you didn't get an error message. If you did, please let me know what it was. If not, let me know if my suggestion helped.

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

카테고리

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