Solving Trigonometric Equations with More Than One Variables
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Yagmur Savkay Öztok
am 4 Aug. 2022
Kommentiert: Yagmur Savkay Öztok
am 8 Aug. 2022
Hi.
My problem is that I have a 3x1 matrix with trigonometric expressions such that:
x = [cos(theta)*sin(phi)*sin(psi) + cos(phi)*sin(theta); -cos(psi)*sin(theta); cos(phi)*sin(psi)*cos(theta) - sin(phi)*cos(psi)*sin(theta)]
And it should be equal to another matrix
with real numbers like:
y = [0.6,-0.76,0]
My code is:
syms theta phi psi
eqn_1 = cos(theta)*sin(phi)*sin(psi) + cos(phi)*sin(theta) == 0.6;
eqn_2 = -cos(psi)*sin(theta) == -0.76 ;
eqn_3 = cos(phi)*sin(psi)*cos(theta) - sin(phi)*cos(psi)*sin(theta) == 0 ;
eqn_4 = theta == -30 * pi / 180 ;
s = solve(eqn_1,eqn_2,eqn_3,eqn_4,theta,phi,psi,'ReturnConditions',true) ;
s.theta
s.phi
s.psi
But as you can see, it does not work. Can you help me,please?
Thanks.
0 Kommentare
Akzeptierte Antwort
John D'Errico
am 4 Aug. 2022
Bearbeitet: John D'Errico
am 4 Aug. 2022
You need to understand that first, the use of solve like this will probably fail. You have 4 equations, but only 3 unknowns. Solve will try to find an exact solution, but the problem is over-determined, so there will be no exact solution.
As bad is the problem that this is equivalent to a polynomial problem in the unknowns, where the degree of the polynomial may be too high for an algebraic solution to be found.
syms theta phi psi
eqn_1 = cos(theta)*sin(phi)*sin(psi) + cos(phi)*sin(theta) == 0.6;
eqn_2 = -cos(psi)*sin(theta) == -0.76 ;
eqn_3 = cos(phi)*sin(psi)*cos(theta) - sin(phi)*cos(psi)*sin(theta) == 0 ;
First, ignore the constraint on theta. We will now get two primary solutions, although infinitely many solutions will exist.
sol = solve(eqn_1,eqn_2,eqn_3)
vpa(sol.phi)
vpa(sol.theta)
vpa(sol.psi)
eqn_4 = theta == -30 * pi / 180 ;
Note that it gets nastier looking if I use 'returnconditions' on the call. But do either of the solutions yield theta = pi/6? It is close, but not going to happen. Just for kicks though, lets try it.
sol = solve(eqn_1,eqn_2,eqn_3,'returnconditions',true); % nasty looking, so leave it hidden
Next, do any of those solutions ever yield theta = pi/6?
solve(sol.theta == pi/6)
So we learn that m must be -1/3. But I thought m had to be an integer.
sol.conditions(1)
So no solutions exist.
Weitere Antworten (1)
Alan Stevens
am 4 Aug. 2022
You have theta = 30degrees, so sin(theta) is 1/2.
Therefore, in equation 2, you have cos(psi)/2 = 0.76, so cos(psi) > 1. If you are dealing with real numbers this is invalid!
3 Kommentare
Siehe auch
Kategorien
Mehr zu Linear Algebra 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!