i want to solve a set of homogeneous linear equation

3 views (last 30 days)
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

Accepted Answer

Dyuman Joshi
Dyuman Joshi on 22 Mar 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)
sol = struct with fields:
x1: 1 x2: -1/2 x3: -1 x4: -1 x5: 1/2
  3 Comments

Sign in to comment.

More Answers (1)

Torsten
Torsten on 23 Mar 2023
Edited: Torsten on 23 Mar 2023
Or use the following code to produce an optimal solution in the least-squares sense:
A =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]
A = 4×4
66064 -35642 0 0 -35642 66064 -35642 0 0 -35642 66064 -35642 0 0 -35642 32624
C = -A(:,1);
B = A(:,2:end)\C
B = 3×1
1.8535 2.4356 2.6609
A*[1;B]
ans = 4×1
0.2555 0.4735 0.6221 0.6797

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!