Extract exponent of term in symbolic expression?

11 Ansichten (letzte 30 Tage)
Adam Darcie
Adam Darcie am 23 Apr. 2020
Kommentiert: Adam Darcie am 26 Apr. 2020
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!

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by