Problem with the product of complex numbers
    14 ビュー (過去 30 日間)
  
       古いコメントを表示
    
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
0 件のコメント
採用された回答
  Jonathan Epperl
      
 2013 年 5 月 24 日
        Probably simplify(Zeq) will do that.
2 件のコメント
  Walter Roberson
      
      
 2013 年 5 月 24 日
				expandsol = expand(sol);
A = real(expandsol);
B = imag(expandsol);
その他の回答 (1 件)
  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
      
      
 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.
参考
カテゴリ
				Help Center および File Exchange で Calculus についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


