필터 지우기
필터 지우기

Symbolic toolbox with complex exponentials

조회 수: 25 (최근 30일)
Alex Gros-Balthazard
Alex Gros-Balthazard 2019년 8월 11일
댓글: Star Strider 2019년 8월 11일
Hello Matlab people,
I have a question about the symbolic toolbox when using complex numbers.
Quite often I will end up with a solution to either a differential equation or by some manner, in which the matrix solution is the sum of complex exponentials representing real valued a signal. But I can't seem to reliably force matlab to just combine them.
So for example:
exp(t*(4 - 2i))/2 + exp(t*(4 + 2i))/2
a symbolic function of t.
Of course, in final form we would normally want to express that as a sinusoid multiplied by a real exponential.
I've tried the combine function (maybe not correctly), expand, collect.. I've hand written an inverse laplace transform to convert complex conjugate poles and residues automatically to convert compex residues conjugate poles into "normal looking" real valued functions when doing inverse laplace which seems to work until the numerical inaccuracy starts to grow for more complicated transfer functions.
Is there a way to get matlab to do autmatically combine the complex conjugate exponential terms into sinusoidal functions?
So the above expression could be of the form:
exp( 4*t ) * cos( 2t)
And more generally of the form:
A * exp( a*t) * cos( w*t + theta )
or
B1 * exp( a*t) * cos( w*t ) + B2 * exp( a*t) * sin( w*t )
Thanks.

채택된 답변

Star Strider
Star Strider 2019년 8월 11일
One approach is to use the rewrite and simplify functions:
syms t
y = exp(t*(4 - 2i))/2 + exp(t*(4 + 2i))/2
Y = simplify(rewrite(y, 'sin'), 'Steps', 50)
producing:
y =
exp(t*(4 - 2i))/2 + exp(t*(4 + 2i))/2
Y =
cos(2*t)*exp(4*t)
See the documentation for the fucntions for details and examples.
  댓글 수: 2
Alex Gros-Balthazard
Alex Gros-Balthazard 2019년 8월 11일
Thank you.
Star Strider
Star Strider 2019년 8월 11일
As always, my pleasure.

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

추가 답변 (1개)

Alex Gros-Balthazard
Alex Gros-Balthazard 2019년 8월 11일
That's interesting, so it actually seems to work even if you don't explicitlly use the rewrite function.
Just
simplify( y , 'Steps', 50 );
So I needed to allow simplification to take more steps.
Wow, the default number of simplification steps is n=1 according to the docs..
  댓글 수: 1
Star Strider
Star Strider 2019년 8월 11일
True, although rewrite can be extremely useful, especially if you want a result in a particular form. Telling simplify to keep working until it arrives at the best result usually works as werll. I’ve used up to 500 steps in some situations.

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

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by