MATLAB Answers

Extract exponent of term in symbolic expression?

3 views (last 30 days)
Adam Darcie
Adam Darcie on 23 Apr 2020
Commented: Adam Darcie on 26 Apr 2020
Let's say I have some symbolic expression expression:
syms a b c 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!


Sign in to comment.

Answers (1)

Christopher Creutzig
Christopher Creutzig on 24 Apr 2020
I believe you are looking for polynomialDegree:
>> polynomialDegree(expression,a)
ans =

  1 Comment

Adam Darcie
Adam Darcie on 26 Apr 2020
I knew something like this had to exist but I couldn't find it. Thanks!

Sign in to comment.