Simplify symbolic division abs(Z)/Z
조회 수: 1 (최근 30일)
이전 댓글 표시
In a symbolic expression with syms Z complex, Matlab does not simplify simplify(abs(Z)^2/Z) to conj(Z) but it simplifies simplify(abs(Z)^2/conj(Z)) to Z. Is it possible to make sure that simplify(abs(Z)^2/Z) yields conj(Z)? I'm working with R2023b. Thanks!
댓글 수: 0
답변 (2개)
Torsten
2023년 11월 2일
편집: Torsten
2023년 11월 2일
Use z*z' instead of abs(z)^2:
syms z
u = z*z'/z
Walter Roberson
2023년 11월 3일
syms z
syms zr zi real
u = abs(z)^2/z
us = simplify(subs(u, z, zr + 1i*zi))
After which you would need to substitute conj(z) for zr-zi*1i
However it is probably easiest to do something like
syms z
u = abs(z)^2/z + 5*z^2 - 3*z + 2
subs(u, abs(z)^2/z, conj(z))
If you have something more complex, where you have the general pattern abs(EXPRESSION)^2/EXPRESSION then you could proceed by using mapSymType ... but it does get complicated if you have terms such as (x*abs(x + y)^2)/(y*(x + y)) then it can be complicated to properly detect a match.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!