matlab - solving linear complex system of equations -
suppose system of equations looks like:
a(1+2i) + b(100i) =10i; conj(a)*(11i) +b(12+ 17i)= 167;
where a
, b
complex numbers;
how solve a
, b
using matlab? (i need solve system of 10 equations.)
this math problem. have 4 equations in 4 unknowns once separate real/imag components
a*(1+2i) + b*(100i) =10i; conj(a)*(11i) +b*(12+ 17i)= 167;
is equivalent
real(a) - 2*imag(a) - 100*imag(b) = 0 2*real(a) + imag(a) + 100*real(b) = 10 11*imag(a) + 12*real(b) - 17*imag(b) = 167 11*real(a) + 17*real(b) + 12*imag(b) = 0
then define coefficients x= [real(a) imag(a) real(b) imag(b)] in linear equations , solve them
a= [1 -2 0 -100 2 1 100 0 0 11 12 -17 11 0 17 12]; b = [0 10 167 0]'; a\b ans = 0.4049 14.7920 -0.0560 -0.2918
so a=0.4049+14.7929i
, b = -0.0560 -0.2908i
with mean rounding errors.
of course not helpful if have 10 complex equations (20 equations in 20 unknowns). can rewrite system above
real(a) - 2*imag(a) - 100*imag(b) = 0 + 12*real(b) + 11*imag(a) - 17*imag(b) = 167 2*real(a) + 100*real(b) + imag(a) = 10 11*real(a) + 17*real(b) + 12*imag(b) = 0
and defining
d= [(1+2i) (100i) (11i) (12+17i) ]; c = [10i 167]';
(from original system dx=c) 1 recognizes e*x_=f with
e = [ real(d) -imag(d) imag(d) real(d) ]; f = [real(c) ; imag(c)];
except terms have signs switched due conjugation operation. can taken care off separately multiplying array e
appropriate matrix of ones
sign inverted terms involved in complex conjugate operation. can done follows. define matrix conj
containing 1
@ locations in original pair of equations conjugate operation applied:
conj=[ 0 0 1 0];
then sign matrix is
sgn = 2* ([ imag(conj) -real(conj) real(conj) imag(conj)]+1 >0)-1;
and solution
(e.*sgn)\f ans = 0.4049 -0.0560 14.7920 -0.2918
Comments
Post a Comment