i want to solve a set of homogeneous linear equation
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shardul
am 22 Mär. 2023
Bearbeitet: Torsten
am 23 Mär. 2023
A = (n,n) :- a (n,n) order of matrix which i get from previous calculations
B = [1 , x1 , x2 , x3 , .......... xn]' :- vector in which 1st element is 1 and rest all are unknown of (n,1) order
C = [0 , 0 , 0 , 0 ]' :- null vector of (n,1) order
i want solution to A*B = C
that will give me values of B vectors
0 Kommentare
Akzeptierte Antwort
Dyuman Joshi
am 22 Mär. 2023
Note - Symbolic Toolbox required
Note that you might not get a solution for x depending upon the values of A.
One such example would be - A is an Identity matrix, any order greater than 1; or in this particular case, magic() of any odd order
%Random example
A=magic(6);
n=size(A,1);
syms x [n-1 1]
B=[1;x];
sol=solve(A*B==0,x)
3 Kommentare
Dyuman Joshi
am 22 Mär. 2023
As I said earlier - "Note that you might not get a solution for x depending upon the values of A."
For the values you have for A, there is no solution for x.
P = 1.0e+04*[6.6064,-3.5642,0,0;-3.5642,6.6064,-3.5642,0;0,-3.5642,6.6064,-3.5642;0,0,-3.5642,3.2624];
na = size(P,1);
syms u [na-1 1]
Ba = [1; u];
%Let's solve for each equation corresponding to each row
y = P*Ba
%1st equation, get the value of u1
U1 = solve(y(1)==0)
%2nd equation, use u1 to get the value of u2
U2 = solve(subs(y(2),u1,U1)==0,u2)
Now we have two equations remaining to get the value of u3, and the values of u1 and u2 will only be correct if we get the same u3 from
%value of u3 from 3rd equation
U3_1 = solve(subs(y(3),[u1 u2],[U1 U2])==0,u3)
%value of u3 from 4th equation
U3_2 = solve(subs(y(4),u2,U2)==0,u3)
As you can see, the values of u3 are not the same and hence there are no unique values for which the equation P*Ba=0 is satisfied.
The empty output (i.e. 0x1 sym) denote that there is no solution to the equation.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!