How can I get analytical solution of trigonometric equations?

the constants are:
k11 = (16*V1*V1)/(n^3*(pi)^2*(2*pi*f)*L)
k22 = (16*V2*V2)/(n^3*(pi)^2*(2*pi*f)*L)
k33 = (16*V3*V3)/(n^3*(pi)^2*(2*pi*f)*L)
k12 = (8*V1*V2)/(n^3*(pi)^2*(2*pi*f)*L)
k13 = (8*V1*V3)/(n^3*(pi)^2*(2*pi*f)*L)
k23 = (8*V2*V3)/(n^3*(pi)^2*(2*pi*f)*L)
The equations are:
P1 = (k12.*cos(x(1)*pi/360).*cos(x(2)*pi/360).*sin(x(4)*pi/180))+(k13.*cos(x(1)*pi/360).*cos(x(3)*pi/360).*sin(x(5)*pi/180))
P2 = -(k12.*cos(x(1)*pi/360).*cos(x(2)*pi/360).*sin(x(4)*pi/180))+(k23.*cos(x(2)*pi/360).*cos(x(3)*pi/360).*sin((x(5)-x(4))*pi/180))
P3 = -(k13.*cos(x(1)*pi/360).*cos(x(3)*pi/360).*sin(x(5)*pi/180))+(k23.*cos(x(2)*pi/360).*cos(x(3)*pi/360).*sin((x(4)-x(5))*pi/180))
Q1 = (k11.*cos(x(1)*pi/360).*cos(x(1)*pi/360))-(k12.*cos(x(1)*pi/360).*cos(x(2)*pi/360).*cos(x(4)*pi/180))-(k13.*cos(x(1)*pi/360).*cos(x(3)*pi/360).*cos(x(5)*pi/180))
Q2 = -(k12.*cos(x(1)*pi/360).*cos(x(2)*pi/360).*cos(x(4)*pi/180))+(k22.*cos(x(2)*pi/360).*cos(x(2)*pi/360))-(k23.*cos(x(2)*pi/360).*cos(x(3)*pi/360).*cos((x(5)-x(4))*pi/180))
Q3 = -(k13.*cos(x(1)*pi/360).*cos(x(3)*pi/360).*cos(x(5)*pi/180))-(k23.*cos(x(2)*pi/360).*cos(x(3)*pi/360).*cos((x(5)-x(4))*pi/180))+(k33.*cos(x(3)*pi/360).*cos(x(3)*pi/360))
How can I solve for the angles x(1), x(2), x(3), x(4) and x(5)? Can anyone please help me to solve these equations?

댓글 수: 8

Can anyone please comment on this problem and advise me how to solve it?
Did you try using solve? What does it do? If you tried nothing, then why not?
Note: there is a very good chance there is no analytical solution.
Hi John. Thanks for your comments. Yes I have tried several times using many functions such as fmincon, fsolve and isqnonlin. It has been confirmed that the solutions I am getting are same for each function. For example, for
L = 22.5e-6; V1 = V2 = V3 = 40, n=1 and f=20e3;
and
P1 = 400; P2 = -200; P3 = -200; Q1 = 193; Q2 = 96.86; Q3 = -96.86;
fmincon gives (angles are in degrees)
x(1)=-0.0000 x(2)=28.2228 x(3)=71.3840 x(4)=27.8753 x(5)=29.6215
Isqnonlin gives
x(1)=0.0000 x(2)=28.2228 x(3)=71.3840 x(4)=27.8753 x(5)=29.6215
fsolve gives
x(1)=0.0182 x(2)=28.2228 x(3)=71.3840 x(4)=27.8753 x(5)=29.6215
so these are the numerical solutions and I think that these are correct as confirmed by three different functions but I want the exact analytical solution. I tried with the solve function but end up with
Here is my code:
if true
syms x1 x2 x3 x4 x5 V1 V2 V3 f L k11 k22 k33 k12 k13 k23 P1 P2 P3 Q1 Q2 Q3
k11 = (16*V1*V1)/((pi)^2*(2*pi*f)*L)
k22 = (16*V2*V2)/((pi)^2*(2*pi*f)*L)
k33 = (16*V3*V3)/((pi)^2*(2*pi*f)*L)
k12 = (8*V1*V2)/((pi)^2*(2*pi*f)*L)
k13 = (8*V1*V3)/((pi)^2*(2*pi*f)*L)
k23 = (8*V2*V3)/((pi)^2*(2*pi*f)*L)
eqn_P1 = (k12.*cos(x1*pi/360).*cos(x2*pi/360).*sin(x4*pi/180))+(k13.*cos(x1*pi/360).*cos(x3*pi/360).*sin(x5*pi/180)) == P1
eqn_P2 = -(k12.*cos(x1*pi/360).*cos(x2*pi/360).*sin(x4*pi/180))+(k23.*cos(x2*pi/360).*cos(x3*pi/360).*sin((x5-x4)*pi/180)) == P2
eqn_P3 = -(k13.*cos(x1*pi/360).*cos(x3*pi/360).*sin(x5*pi/180))+(k23.*cos(x2*pi/360).*cos(x3*pi/360).*sin((x4-x5)*pi/180)) == P3
eqn_Q1 = (k11.*cos(x1*pi/360).*cos(x1*pi/360))-(k12.*cos(x1*pi/360).*cos(x2*pi/360).*cos(x4*pi/180))-(k13.*cos(x1*pi/360).*cos(x3*pi/360).*cos(x5*pi/180)) == Q1
eqn_Q2 = -(k12.*cos(x1*pi/360).*cos(x2*pi/360).*cos(x4*pi/180))+(k22.*cos(x2*pi/360).*cos(x2*pi/360))-(k23.*cos(x2*pi/360).*cos(x3*pi/360).*cos((x5-x4)*pi/180)) == Q2
eqn_Q3 = -(k13.*cos(x1*pi/360).*cos(x3*pi/360).*cos(x5*pi/180))-(k23.*cos(x2*pi/360).*cos(x3*pi/360).*cos((x5-x4)*pi/180))+(k33.*cos(x3*pi/360).*cos(x3*pi/360)) == Q3
S = solve(eqn_P1, eqn_P2, eqn_P3, eqn_Q1, eqn_Q2, eqn_Q3, -pi/2<x1, x1<pi/2, -pi/2<x2, x2<pi/2, -pi/2<x3, x3<pi/2, -pi/2<x4, x4<pi/2, -pi/2<x5, x5<pi/2, 'ReturnConditions', true);
end
and the results comes up as:
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
In test_5 (line 22)
Wait -- P1, P2, P3, Q1, Q2, Q3 are intended to be definite values, not names of the equations that are assumed to have value equal to zero ?
Mukul
Mukul 2018년 6월 23일
편집: Mukul 2018년 6월 23일
Dear Walter,
Yes P1, P2, P3, Q1, Q2, Q3 should be definite values. Basically I want the analytical expression for angles (x1 to x5) in terms of these variables (P1, P2, P3, Q1, Q2, Q3, V1,V1,V3,f,L)
Hi Walter, Can you please comment where the problem is in my code?
and
is it possible to solve the equations for angles for the above code using solve function?
There is not necessarily any error in your code. The system is just difficult to solve.
My work so far shows that for each x1 there are two x2, and that for each x2 there are four x3. Computation is slow, so I have not gotten further than that quite yet.
Ok Walter, please let me inform what you get when the computation would finish

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

 채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 22일
Analytic solution:
x(1) = 180 + 360*Z1
x(2) = 180 + 360*Z2;
x(3) = 180 + 360*Z3;
x(4) and x(5) arbitrary (that is, the above 3 together solve all 5 equations)
Here, Z1, Z2, and Z3 represent arbitrary integers

댓글 수: 6

Dear Walter, Thank you so much for your effort to get this.
Can you please tell me how you get this and what is the expression of Z1, Z2 and Z3? I believe these should be in terms of other variables in the equations.
If you follow this post, I have solved these equations for angles using three different functions for specific values of variables. But I want exact analytical solution/expression of the angles that you have given.
I tried with the solve function and I can't get to your solution and here is my code:
.
syms x1 x2 x3 x4 x5 V1 V2 V3 f L k11 k22 k33 k12 k13 k23 P1 P2 P3 Q1 Q2 Q3
k11 = (16*V1*V1)/((pi)^2*(2*pi*f)*L)
k22 = (16*V2*V2)/((pi)^2*(2*pi*f)*L)
k33 = (16*V3*V3)/((pi)^2*(2*pi*f)*L)
k12 = (8*V1*V2)/((pi)^2*(2*pi*f)*L)
k13 = (8*V1*V3)/((pi)^2*(2*pi*f)*L)
k23 = (8*V2*V3)/((pi)^2*(2*pi*f)*L)
eqn_P1 = (k12.*cos(x1*pi/360).*cos(x2*pi/360).*sin(x4*pi/180))+(k13.*cos(x1*pi/360).*cos(x3*pi/360).*sin(x5*pi/180)) == P1
eqn_P2 = -(k12.*cos(x1*pi/360).*cos(x2*pi/360).*sin(x4*pi/180))+(k23.*cos(x2*pi/360).*cos(x3*pi/360).*sin((x5-x4)*pi/180)) == P2
eqn_P3 = -(k13.*cos(x1*pi/360).*cos(x3*pi/360).*sin(x5*pi/180))+(k23.*cos(x2*pi/360).*cos(x3*pi/360).*sin((x4-x5)*pi/180)) == P3
eqn_Q1 = (k11.*cos(x1*pi/360).*cos(x1*pi/360))-(k12.*cos(x1*pi/360).*cos(x2*pi/360).*cos(x4*pi/180))-(k13.*cos(x1*pi/360).*cos(x3*pi/360).*cos(x5*pi/180)) == Q1
eqn_Q2 = -(k12.*cos(x1*pi/360).*cos(x2*pi/360).*cos(x4*pi/180))+(k22.*cos(x2*pi/360).*cos(x2*pi/360))-(k23.*cos(x2*pi/360).*cos(x3*pi/360).*cos((x5-x4)*pi/180)) == Q2
eqn_Q3 = -(k13.*cos(x1*pi/360).*cos(x3*pi/360).*cos(x5*pi/180))-(k23.*cos(x2*pi/360).*cos(x3*pi/360).*cos((x5-x4)*pi/180))+(k33.*cos(x3*pi/360).*cos(x3*pi/360)) == Q3
S = solve(eqn_P1, eqn_P2, eqn_P3, eqn_Q1, eqn_Q2, eqn_Q3, -pi/2<x1, x1<pi/2, -pi/2<x2, x2<pi/2, -pi/2<x3, x3<pi/2, -pi/2<x4, x4<pi/2, -pi/2<x5, x5<pi/2, 'ReturnConditions', true);
end
and the results I am getting is something like:
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
In test_5 (line 22)
could you please explain it bit more?
As I wrote,
Here, Z1, Z2, and Z3 represent arbitrary integers
For example you could use Z1 = -34834756 and Z2 = 0 and Z3 = 12345
That is, your functions are periodic, and the solutions repeat every 360 infinitely in both directions.
"Can you please tell me how you get this"
I used Maple and I asked it to solve eqn_P1 for x1 asking for all solutions. That gave me the 180 + (integer of your choice)*360 for x1. I substituted that x1 into eqn_P2 through eqn_Q3 and asked to solve that for x2, getting out 180 + (integer of your choice)*360 for x2. I substituted the x1 and x2 values into eqn_P3 through eqn_Q3 and saw that eqn_P3, eqn_Q1, and eqn_Q2 became identical to 0, indicating that they were linear dependent on the first two equations. eqn_Q3 still had a value that involved x3 so I solved for that, getting out 180 + (integer of your choice)*360 for x3. Those set of 3 values together are solutions no matter what the x4 and x5 values are.
Dear Walter, what you have found is also a numerical values of the angles that I also found, if you see my above post where I assumed some fixed values for the variables.
How did you get numerical values? Did you assume some values for P1, P2,P3, Q1, Q2,Q3 and other variables?
I am expecting analytical expression of the angles where I can get different angles values for different variables. I expect the angle, x1 should be in the below form:
x1 = arccos(R)
R = should be a complex equation containing other variables like P,Q,V,L and sin(x4), sin(x5)
You can solve the first equation set, eqn1, for the first variable x1. Substitute that into the remaining equations, getting eqn2, one shorter than before. Solve the first equation of eqn2 for the second variable x2, getting two solutions. Substitute the first solution of x2 into the remaining variables for eqn2, getting eqn3 that is one shorter still.
Now, solving the first equation of eqn3 (which was the third equation of the original set) with respect to x3, x4, or x5 pretty much fails, so we do not get anywhere with that.
Solve the second equation of eqn3 (which was the fourth equation of the original set) with respect to x3. Substitute that into eqn3([1,3, 4]), getting eqn4 with three equations.
At this point, eqn4(1) is the same equation that we failed to solve for x3, x4, or x5, and we have made it even more complicated by the substitution of x3, so we will not be able to get anywhere easily by solving it.
We can now try to solve eqn4(2) [which used to be the fifth equation] for x4. But it will take a long time. I do not know yet if it can work; my system has been computing it for hours so far.
If eventually we do get a solution, take the first value, substitute it into eqn4(3) [which used to be the sixth equation] and try to solve for x5. This will leave eqn4(1) to substitute x5 into, and as all variables would now have been substituted in, you would check to see if the equation is consistent.
If the equation is not consistent, then back up to the last place you had a choice about which of multiple solutions you substituted, and try the next possibility and move forward from there.
If all goes well, eventually you get a consistent solution.
It is not likely that you will get a consistent solution for six trig equations in five variables.
If you are trying to solve for analytical equations of motion of a multi-jointed arm, then be advised that most such systems people try to solve are analytically inconsistent or else have multiple fairly different solutions.
Dear Walter,
I am waiting to solutions you have got so far.
Would you prefer solving these equations using solve function or any other way you suggest for me?
Solving for x(4) and x(5) both failed at the place I was indicating was taking a long time. I did not go back to try substituting in the other choices.

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

추가 답변 (0개)

카테고리

질문:

2018년 6월 20일

댓글:

2018년 6월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by