Symbolic expansions, is it possible to express a solution as a series of exponentials

1 Ansicht (letzte 30 Tage)
Lets say I have something like
f_t = (A*cos(a*t) + B*sin(b*t))*(C*cos(c*t) + D*sin(c*t)),
what I would like is something of the form
f_t = c_1 exp(k1*t) + c_2 exp(k2*t) + ... + c_N exp(kN*t) .
I can't find anything within the symbolic toolbox that allows expansion in this form. I don't really want to write one either until I know for sure there isn't one included / on the FEX. Anyone that can help?

Akzeptierte Antwort

Star Strider
Star Strider am 9 Jun. 2014
There is one in the Symbolic Math Toolbox: rewrite!
To wit:
syms A a t
f_t = (A*cos(a*t) + B*sin(b*t))*(C*cos(c*t) + D*sin(c*t));
f_t = rewrite(f_t, 'exp')
produces:
f_t =
(A*(exp(-a*t*i)/2 + exp(a*t*i)/2) + B*((exp(-b*t*i)*i)/2 - (exp(b*t*i)*i)/2))*(C*(exp(-c*t*i)/2 + exp(c*t*i)/2) + D*((exp(-c*t*i)*i)/2 - (exp(c*t*i)*i)/2))
You’ll have to play with it it get the result in your example. There may not be any direct way to do that.
  4 Kommentare
David H
David H am 10 Jun. 2014
Bearbeitet: David H am 11 Jun. 2014
Currently the only way I can really see to do this after the rewrite to then apply "expand". This is products of exponentials
(A*C*exp(-a*t*i)*exp(-c*t*i))/4 + (A*C*exp(-a*t*i)*exp(c*t*i))/4 + (A*C*exp(a*t*i)*exp(-c*t*i))/4 + (A*C*exp(a*t*i)*exp(c*t*i))/4 + (A*D*exp(-a*t*i)*exp(-c*t*i)*i)/4 - (A*D*exp(-a*t*i)*exp(c*t*i)*i)/4 +...
I suppose now I would need a string search to identify exponential products and combine them into a single exponential, running this recursively until no more exponential products can be found. After this I would have to collate the coefficients on exponentials with identical exponents.
Edit: I wrote something to do this final step, regretably it is a bit of a hash but it seems to work for the examples I have tried! On the FEX (46905-express-as-exponential-series)
Star Strider
Star Strider am 10 Jun. 2014
Bearbeitet: Star Strider am 11 Jun. 2014
It would seem so.
I also experimented with subexpr, but wasn’t sure that’s what you wanted to do, so didn’t suggest it earlier. If the constants are related in some way, subs may also help. To break them out into fractional numerators and denominators, numden could help.
Explore the options in the Formula Rearrangement and Rewriting section of the documentation. I’m not certain you can do exactly what you want, but you can probably get close. Delving into MuPad directly may also provide options the Symbolic Math Toolbox does not, at least easily.
EDIT — I’ll take a look at it!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by