How to solve a complex equation which has one equation but two real variables?

21 views (last 30 days)
Normally, a set of equations that have the same number of unknowns can be solved. However, an complex eqaution with two unknowns are possible to be solved. For example, a complex equation like : x+y*j = a+ b*j, can be solved by x = a, and y = b, because the real part and imaginary part correspond to each other.
Now, my question is how to do it with MATLAB solve function. A typical scanerio is the propagation constant solution in EM wave. The original eqaution is:
Kc = omiga* sqrt(u*(eps-j*sigma/omiga));
we would like to solve the equation into Kc = k_real -j* k_img. k_real and k_img are the unknowns in the equation.

Answers (2)

Torsten
Torsten on 14 Feb 2019
Edited: Torsten on 14 Feb 2019
Does that help ?
>> syms z k
>> z0 = 1+3*1I;
>> a = solve(z==k*z0,z)
a = (sym) k*(1 + 3*I)
>> real(a)
ans = (sym) re(k) - 3*im(kc)
>> imag(a)
ans = (sym) 3*re(k) + im(kc)
  3 Comments
madhan ravi
madhan ravi on 14 Feb 2019
Edited: madhan ravi on 14 Feb 2019
>> syms z complex
% ^^^^^^^---- add the assumption
>> syms k
>> z0 = 1+3*1i;
>> a = solve(z==k*z0,z)
a =
k*(1 + 3i)
>> real(a)
ans =
real(k) - 3*imag(k)
>> imag(a)
ans =
imag(k) + 3*real(k)
>>
Walter Roberson
Walter Roberson on 14 Feb 2019
complex is the default assumption and does not need to be added. Instead add real to the variables intended to be real valued.

Sign in to comment.


Walter Roberson
Walter Roberson on 14 Feb 2019
split the equation into two parts by taking real() and imag() so you end up with two equations in two unknowns .

Community Treasure Hunt

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

Start Hunting!