Borrar filtros
Borrar filtros

simplifying mathematics of symbolic expression

2 visualizaciones (últimos 30 días)
Suma
Suma el 15 de Mzo. de 2014
Comentada: Suma el 19 de Mzo. de 2014
I have a symbolic matrix
[ cos(conj(x))*cos(x), cos(conj(x))*exp(a*i)*sin(x)]
[ sin(conj(x))*exp(-conj(a)*i)*cos(x), sin(conj(x))*exp(a*i)*exp(-conj(a)*i)*sin(x)]
It looks so difficult and ugly. I am looking for simplified expression for the above something like the one below-
[ (cos(x))^2 cos(x)*exp(a*i)*sin(x)]
[sin(x)*exp(-conj(a)*i)*cos(x) (sin(x))^2 ]
since x is angle it does not have conjugate so I would like to have cos(conj(x)) as cos(x) and therefore cos(conj(x))*cos(x) as (cos(x))^2 or even better cos2x where 2 is in superscript as we normally have while writing.
Also exp(a*i)*exp(-conj(a)*i) would normally have cancelled out to give 1 but the resulted expression doesn't simplify to it
Can anybody help me here
thanks very much

Respuestas (1)

Star Strider
Star Strider el 15 de Mzo. de 2014
Editada: Star Strider el 15 de Mzo. de 2014
You are not telling the Symbolic Toolbox everything you know about your system. See if this code does something similar to what you want:
syms x a
assume(a, 'real')
assumeAlso(x, 'real')
f = [ [ cos(conj(x))*cos(x), cos(conj(x))*exp(a*i)*sin(x)]; [ sin(conj(x))*exp(-conj(a)*i)*cos(x), sin(conj(x))*exp(a*i)*exp(-conj(a)*i)*sin(x)] ]
fs = simplify(collect(f))
Note that when it knows that x is real, it eliminates conj(x).
‘Also exp(a*i)*exp(-conj(a)*i) would normally have cancelled out to give 1 but the resulted expression doesn't simplify to it’
It does now that it knows what you know about a:
g = exp(a*i)*exp(-conj(a)*i)
Experiment with it and the various functions in the Symbolic Toolbox to get the result in the form you want.
If you want it as a function you can execute as regular MATLAB code (outside of the Symbolic Math Toolbox), see matlabFunction.
  11 comentarios
Walter Roberson
Walter Roberson el 17 de Mzo. de 2014
Try with x = 2 + 3*i and you will see that cos(conj(x))*cos(x) is not the same as (cos(x))^2
Suma
Suma el 19 de Mzo. de 2014
ok thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by