필터 지우기
필터 지우기

How do I get the solutions to this system of eqns

조회 수: 2 (최근 30일)
Andrew
Andrew 2023년 10월 17일
답변: Sulaymon Eshkabilov 2023년 10월 17일
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