필터 지우기
필터 지우기

Problem with the product of complex numbers

조회 수: 7 (최근 30일)
clement
clement 2013년 5월 24일
Hello,
I calculated the equivalent impedance of an RLC circuit, and I would like this one to be completely resistive (complex part equals to 0). So I declared my variables as 'syms' and I used the function 'solve' to obtain the equivalent impedance litterally like:
% syms R X Y Z
% Zeq=solve('(R+i*X)*(-i*Y)/(R+i*X-i*Y)=Z',Z)
The problem is that Matlab gives me a solution like this:
%Zeq =
% -(Y*(R + X*i)*i)/(R + X*i - Y*i)
But I would like something like: Zeq = A + i*B.
Could anyone help?
Thanks

채택된 답변

Jonathan Epperl
Jonathan Epperl 2013년 5월 24일
Probably simplify(Zeq) will do that.
  댓글 수: 2
clement
clement 2013년 5월 24일
Thanks it's working! But now I've got another problem... When I multiply tne numerator of my fraction by the complex conjugate of the denominator, Matlab gives me this:
%sol = -Y*(R + X*i)*(X - Y + R*i)
instead of A + i*B. And this time 'simplify', or 'factor' don't work.
Walter Roberson
Walter Roberson 2013년 5월 24일
expandsol = expand(sol);
A = real(expandsol);
B = imag(expandsol);

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2013년 5월 24일
You cannot do that unless you add the assumption that the variables are real-valued
syms R X Y Z real
Zeq = simplify(solve((R+i*X)*(-i*Y)/(R+i*X-i*Y)-(Z),Z));
A = simplify(real(Zeq));
B = simplify(imag(Zeq));
A + B*i
  댓글 수: 8
Walter Roberson
Walter Roberson 2013년 5월 25일
Before R2011b, "==" was processed as a logical relationship to be evaluated and the result of the logical evaluation to be passed into solve(). But those versions also did not know how to compare a symbol (with any content) against a number, so the expression would generate an error... unless, of course, A was a number instead of a symbol.
Jonathan Epperl
Jonathan Epperl 2013년 5월 25일
I see, I didn't know that -- so A-50 is the more robust syntax...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by