Variable calculations with matlab
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
is it possible to get variable expressions in matlab?
For example:
From
>> y = (a+b)^2
Can I get
>> y = a^2+2ab+b^2
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 7 Mär. 2013
If you have the Symbolic toolbox,
syms a b
y = expand( (a+b)^2 )
3 Kommentare
Walter Roberson
am 7 Mär. 2013
If the output has the leading - sign then that is the wrong expansion for (1-x)^(-1) which is 1/(1-x) with no leading minus sign.
1/(1-x) appears to already be in binomial expansion form to me. There is no Pascal's triangle entry for -1, and if you consider it as 1 divided by the binomial expansion of (1-x)^1 then it is already in the proper form.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!