필터 지우기
필터 지우기

How to get the real&imaginary mode of the symbolic complex equation

조회 수: 10 (최근 30일)
Ruimin Dai
Ruimin Dai 2020년 6월 30일
댓글: Ruimin Dai 2020년 6월 30일
Hi, it seems the MATLAB(2018b) cannot express the real&imaginary&mode of the symbolic complex equation? For instance, Function=A+1j*B, and I expect "sqrt(A^2+B^2)" as the answer when I type in "abs(Function)". However, Matlab just returned "abs(Funtion)", which is not what I expected.
I found some similar quesiton on these sort of thing, this one "https://it.mathworks.com/matlabcentral/answers/386933-symbolic-complex-number-manipulation" suggets to add "real", and this one "https://it.mathworks.com/matlabcentral/answers/14945-complex-numbers-in-symbolic-toolbox " mentiones to add "simplify". I tried to add both "simplify" and “real”, but Matlab still doesn't understand. I figured that if you type in number, Matlab can easily work out, but if using symbolic, Matlab isn't that intelligent. By the way,software MathCad seems understand better in how to express symbolic complex equation.
Is this just a problem only for 2018b version? If anyone knows how to solve this kind of symbolic complex equation manipulation, that will be very helpful.

채택된 답변

madhan ravi
madhan ravi 2020년 6월 30일
syms A B real
Function = A+1j*B
rewrite(abs(Function),'sqrt')
  댓글 수: 1
Ruimin Dai
Ruimin Dai 2020년 6월 30일
Thank your advice. That solves my question.
I used "assume(A,'real'); assume(B,'real');" instead of "syms A B real", and I overlooked to use "rewrite (Funtion,'sqrt')" in the end. That is why I failed before.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by