how can i solve simultaneous matrix equations?

I hvae to solve the simultaneous matrix equations
X*A=0 and X*e=1 where X is a row vector of finite dimension 1Xu and e =ones(u1,1)
I tried the following How can I Solve simultaneous matrix equation X*A=0 and X*e=1 where X a row vector ,e coloumn vector with all entries one.? i have tried
x=sym('x',[1 u1])
e=ones(u1,1)
eqn=[x*A==0 ,x*e==1]
solx=solve(eqn,x)
but the answer i am getting is a structure but i need it as a matrix. can any one help me?

 採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 10 日

0 投票

u1 = 5;
A = randi([-9 9], u1, 1); %u1 x 1
x=sym('x',[1 u1])
x = 
(x1x2x3x4x5)
e=ones(u1,1)
e = 5×1
1 1 1 1 1
eqn=[x*A==0 ,x*e==1]
eqn = 
(6x25x1x33x4+8x5=0x1+x2+x3+x4+x5=1)
solx=solve(eqn,x)
solx = struct with fields:
x1: [1×1 sym] x2: [1×1 sym] x3: [1×1 sym] x4: [1×1 sym] x5: [1×1 sym]
subs(x,solx)
ans = 
(611511000)

2 件のコメント

Walter Roberson
Walter Roberson 2020 年 10 月 10 日
Sorry, format is a bit messed up. The output vector has two non-zero entries and the rest are all zero.
Thresiamma N J
Thresiamma N J 2020 年 10 月 10 日
Thanks a lot... it works well as per my requirement....

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by