How to solve the equation to get the result in atan2 form?

4 visualizaciones (últimos 30 días)
Shiv Karpoor
Shiv Karpoor el 21 de Mzo. de 2022
Comentada: Shiv Karpoor el 23 de Mzo. de 2022
Hello MATLAB Community,
I am trying to solve an equation in MATLAB, but I don't know which function or how to solve it.
syms phi theta psi
ROT = [cos(theta)*cos(phi)+sin(psi)*sin(theta)*sin(phi), -cos(theta)*sin(phi)+sin(psi)*sin(theta)*cos(phi), cos(psi)*sin(theta); ...
cos(psi)*sin(phi), cos(psi)*cos(phi), -sin(psi); ...
-sin(theta)*cos(phi)+sin(psi)*cos(theta)*sin(phi), sin(theta)*sin(phi)+sin(psi)*cos(theta)*cos(phi), cos(psi)*cos(theta)];
eqn = ROT(1,2) == ROT(2,1)
I tried to use functions like solve, simplify, etc. but I am not getting it in the desired form as shown below:
psi = atan2(sin(phi)*sin(theta),cos(phi)+cos(theta))
Can anyone please help me with any suggestions.
Thank you in advance!!
I really appreciate your help.
Kind regards,
Shiv
  5 comentarios
Mohammed Hamaidi
Mohammed Hamaidi el 23 de Mzo. de 2022
Be careful. The equation has solution under some strict assumptions.
Example:
sin(x)+cos(x)==4
, has no solution,
Matlab gives:
>> solve(cos(x)+sin(x)==4,x)
ans =
-log(- 28i^(1/2)/2 + (2 + 2i))*1i
-log(28i^(1/2)/2 + (2 + 2i))*1i
So, you have to give the assumptions/conditions

Iniciar sesión para comentar.

Respuestas (1)

Torsten
Torsten el 21 de Mzo. de 2022
Editada: Torsten el 21 de Mzo. de 2022
syms phi theta psi
ROT = [cos(theta)*cos(phi)+sin(psi)*sin(theta)*sin(phi), -cos(theta)*sin(phi)+sin(psi)*sin(theta)*cos(phi), cos(psi)*sin(theta); ...
cos(psi)*sin(phi), cos(psi)*cos(phi), -sin(psi); ...
-sin(theta)*cos(phi)+sin(psi)*cos(theta)*sin(phi), sin(theta)*sin(phi)+sin(psi)*cos(theta)*cos(phi), cos(psi)*cos(theta)];
eqn = ROT(1,2) == ROT(2,1);
sol = solve(eqn,psi)
  11 comentarios
Torsten
Torsten el 23 de Mzo. de 2022
Editada: Torsten el 23 de Mzo. de 2022
You didn't get David's point.
Your formula to calculate psi as
psi = atan2(sin(phi)*sin(theta),cos(phi)+cos(theta))
seems to be wrong.
But now you know the solution to write psi in terms of phi and theta in symbolic form (the expression from octave). Why don't you simply copy it and use it in your code or whereever you need it ?
Shiv Karpoor
Shiv Karpoor el 23 de Mzo. de 2022
Oh, Okay.
Might be wrong I can't tell, because I got it from journal paper.
I will do as suggested,
Thanks Torsten, I appreciate your help!

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by