Extract exponent of term in symbolic expression?

조회 수: 11 (최근 30일)
Adam Darcie
Adam Darcie 2020년 4월 23일
댓글: Adam Darcie 2020년 4월 26일
Let's say I have some symbolic expression expression:
syms a b c d
expression=a^2*b^4*c^3*d
I want to extract the exponent of a given symbol. For example, if I ask for the exponent of a, it should give 2. I can't seem to find any solutions that work in the current version of Matlab. There must be some simple way of doing this in 2020 right?
Thanks in advance!

답변 (1개)

Christopher Creutzig
Christopher Creutzig 2020년 4월 24일
I believe you are looking for polynomialDegree:
>> polynomialDegree(expression,a)
ans =
2
  댓글 수: 1
Adam Darcie
Adam Darcie 2020년 4월 26일
I knew something like this had to exist but I couldn't find it. Thanks!

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by