Abs and angle of complex number with symbolic object
5 ビュー (過去 30 日間)
古いコメントを表示
Hi,
If r=sym('a')*exp(j*sym('b')) is a symbolic object, and
1. if I write abs(r), I get abs(a).....I need get only "a" without abs
2. if I write angle(r), I get error
??? Undefined function or method 'atan2' for input arguments of type 'sym'.
Error in ==> angle at 14 p = atan2(imag(h), real(h));
Can you help me please? How can I solve this?
0 件のコメント
採用された回答
Walter Roberson
2013 年 3 月 5 日
There is no "complex argument" function for symbolic variables exposed at the MATLAB level. You can, though, define
arg = @(V) feval(symengine, 'arg', V);
その他の回答 (1 件)
Brian B
2013 年 3 月 4 日
編集済み: Brian B
2013 年 3 月 4 日
Well, for part 1 you have to assume a is a non-negative real:
syms a
assume(a>0)
Then
>> abs(a)
ans =
a
I have not tried the second part, but you can imagine dividing by the magnitude and taking a log....
参考
カテゴリ
Help Center および File Exchange で Special Values についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!