How do I get the solutions to this system of eqns

2 次查看(过去 30 天)
x = [ 1 1 1; -3 3+5i 3-5i; 9 34+30i 34-30i];
y = [28/3;15/2;9];
  2 个评论
Les Beckham
Les Beckham 2023-10-17
x = [ 1 1 1; -3 3+5i 3-5i; 9 34+30i 34-30i]
x =
1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i -3.0000 + 0.0000i 3.0000 + 5.0000i 3.0000 - 5.0000i 9.0000 + 0.0000i 34.0000 +30.0000i 34.0000 -30.0000i
y = [28/3;15/2;9]
y = 3×1
9.3333 7.5000 9.0000
That is not a system of equations, it is two assignment statements that create a complex matrix and a real column vector. Please specify the actual equation that you wish to solve.
Andrew
Andrew 2023-10-17
x + y + z = 28/3
-3x + (3+5i)y + (3-5i)z = 15/2
9x + (34+30i)y + (34-30i)z = 9
this is the system.

请先登录,再进行评论。

回答(2 个)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023-10-17
Simply use \, linsolve(), inv(), etc. E.g.:
x = [ 1 1 1; -3 3+5i 3-5i; 9 34+30i 34-30i];
y = [28/3;15/2;9];
Solution1 = linsolve(x,y)
Solution1 =
-16.8485 + 0.0000i 13.0909 +12.1591i 13.0909 -12.1591i
Solution2 = x\y
Solution2 =
-16.8485 + 0.0000i 13.0909 +12.1591i 13.0909 -12.1591i
Solution3 = inv(x)*
Solution3 =
-16.8485 + 0.0000i 13.0909 +12.1591i 13.0909 -12.1591i

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023-10-17
You may also try lsqr(), rref(), svd(), and solve() with syms. E.g.:
x = [ 1 1 1; -3 3+5i 3-5i; 9 34+30i 34-30i];
y = [28/3;15/2;9];
Solution4 = lsqr(x,y)
lsqr converged at iteration 3 to a solution with relative residual 3e-10.
Solution4 =
-16.8485 + 0.0000i 13.0909 +12.1591i 13.0909 -12.1591i
Sol = rref([x,y]);
Solution5 = Sol(:,end)
Solution5 =
-16.8485 + 0.0000i 13.0909 +12.1591i 13.0909 -12.1591i
% svd()
[U,S,V]=svd(x);
Solution6 = V*inv(S)*U'*y
Solution6 =
-16.8485 - 0.0000i 13.0909 +12.1591i 13.0909 -12.1591i
% solve() with syms --> NOT recommended though
syms x y z
A = [ 1 1 1; -3 3+5i 3-5i; 9 34+30i 34-30i];
b = [28/3;15/2;9];
Eqn = A*[x;y;z]==b;
Sol = solve(Eqn)
Sol = struct with fields:
x: -556/33 y: 144/11 + 535i/44 z: 144/11 - 535i/44
Solution7 = double([Sol.x; Sol.y; Sol.z])
Solution7 =
-16.8485 + 0.0000i 13.0909 +12.1591i 13.0909 -12.1591i

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by