Message Boards Message Boards

0
|
6321 Views
|
24 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Non-linear equation system for a two link manipulator

Posted 11 years ago
If someone can kindly help me to find out the solution of this system of equations for the two angles. 

Solve[{Px Cos[Subscript[\[Theta], 1][t]] -   Py Sin[Subscript[\[Theta], 1][t]] - Cos[Subscript[\[Theta], 2][t]]^2 Subscript[L, 2] +  Sin[Subscript[\[Theta], 2][t]]^2 Subscript[L, 2] - ( Cos[Subscript[\[Theta], 1][t]/2] Subscript[L, 1])/Subscript[\[Theta], 1][t] == 0, Py Cos[Subscript[\[Theta], 1][t]] + Px Sin[Subscript[\[Theta], 1][t]] - 2 Cos[Subscript[\[Theta], 2][t]] Sin[Subscript[\[Theta], 2][t]] Subscript[L, 2] - ( Sin[Subscript[\[Theta], 1][t]/2] Subscript[L, 1])/Subscript[\[Theta], 1][t] == 0}, {Subscript[\[Theta], 1][t],Subscript[\[Theta], 2][t]}]
POSTED BY: Muhammad Farid
24 Replies
Thanks Mr. sam, this is the figure of the mechanical system. it consists of two links as is shown. Link 1 is flexible while the Link 2 is rigid. Both the links are mobile and hence their angles ?1 and ?2 changes w.r.t time (t). For the inverse kinematic solution of the problem, i am provided with all other inputs and my aim is to find out the two angles as a function of time to be able to plot them. after substituting the given inputs, the equations become like this:
2 Cos[?1[t]] - 1.5 Sin[?1[t]] == 0.08 Cos[?2[t]]^2 - 0.08 Sin[?2[t]]^2 +0.05/?1 Cos[?1/2[t]],<br>2 Sin[?1[t]] + 1.5 Cos[?1[t]] == 2* 0.08 Cos[?2[t]] Sin[?2[t]] + Sin[?1/2[t]]

i hope, now it is expressed quite clearly. in case of any problem, i will elaborate further.<br>thanks

POSTED BY: farid khattak
Farid for now you just gave the equations. But where is a general formulation of the problem? I mean mechanical problem, not mathematical. What are we trying to do here from physics point of view? Do you have a link to the system description? A picture of the setup maybe? A reference?
POSTED BY: Sam Carrettie
Mr. frank thanks a lot..

I have tried a lot but to no success.

can you apply those approaches on my system to get me out of this trouble?

it will be a big favour for me from your side
POSTED BY: Muhammad Farid
The approaches for deriving kinematic equations are Newton's 2nd law, Lagrange's equations or Hamilton's equations.  Those approaches will give equations with time derivatives in them.
POSTED BY: Frank Kampas
You could calculate one angle as a function of another angle using your equations, but you will not be able to compute time dependence without derivatives.  What is your problem formulation?  Do you have a Lagrangian for the system?  If so, Lagrange's equations will give you the time derivatives.
POSTED BY: Frank Kampas
Thanks Mr. Frank

Regarding your reply, no my equations dont have any lagrangian equation. i need its plotting of the solutions, by using any method like to find the jacobian or newton method or guass elimination. so which ever fits my system of equations descibed above, will be ok for me.
POSTED BY: Muhammad Farid
To get the two angles to be functions of time you need their derivatives in a differential equation.
POSTED BY: Frank Kampas
Thanks Mr. Frank

Yes, but the problem is that my equations are not having any derivatives nor differential equations so how how to plot the solutions of the angles.?
POSTED BY: Muhammad Farid
eqns = {2 Cos[\[Theta]1] - 1.5 Sin[\[Theta]1] ==
   0.08 Cos[\[Theta]2]^2 - 0.08 Sin[\[Theta]2]^2 +
    0.05/\[Theta]1 Cos[\[Theta]1/2],
  2 Sin[\[Theta]1] + 1.5 Cos[\[Theta]1] ==
   2*0.08 Cos[\[Theta]2] Sin[\[Theta]2] + Sin[\[Theta]1/2]}
NSolve[eqns /. \[Theta]1 -> 0.1]
{{Cos[\[Theta]2] -> 0. + 2.20681 I,
  Sin[\[Theta]2] -> 0. - 4.65092 I}, {Cos[\[Theta]2] ->
   0. - 2.20681 I,
  Sin[\[Theta]2] -> 0. + 4.65092 I}, {Cos[\[Theta]2] -> -4.65092,
  Sin[\[Theta]2] -> -2.20681}, {Cos[\[Theta]2] -> 4.65092,
  Sin[\[Theta]2] -> 2.20681}}
These results do not seem to be consistent.  If I make the NSolve variable theta2, I don't get any solution.
POSTED BY: Frank Kampas
Posted 11 years ago
 In[1]:= \[Theta]1[t_] := 2 Sin[t]; \[Theta]2[t_] := 3 Cos[t];
 
 In[2]:= SumOfSqr = ((2 Cos[\[Theta]1[t]] - 1.5 Sin[\[Theta]1[t]]) - (0.08 Cos[\[Theta]2[t]]^2 - 0.08 Sin[\[Theta]2[t]]^2 + 0.05/\[Theta]1[t] Cos[\[Theta]1[t]/2]))^2 + ((2 Sin[\[Theta]1[t]] + 1.5 Cos[\[Theta]1[t]]) - (2*0.08 Cos[\[Theta]2[t]] Sin[\[Theta]2[t]] + Sin[\[Theta]1[t]/2]))^2;
 
 In[3]:={\[Theta]1[t], \[Theta]2[t], t, SumOfSqr} /. NMinimize[SumOfSqr, t, Method->"RandomSearch"][[2]]
 
 Out[3]= {-1.97796, -0.44415, -1.71939, 2.65114}
 
 In[4]:= {\[Theta]1[t], \[Theta]2[t], t, SumOfSqr} /. NMinimize[{SumOfSqr, {\[Theta]1[t]>0, t>0}}, t, Method->"RandomSearch"][[2]]

Out[4]= {0.0261052, 2.99974, 0.013053, 2.43784}
Given well defined functions of time for Theta1 and Theta2 this rapidly tries to find {Theta1, Theta1, time, sum of squares for those values}.
Notice that I have formed a single sum of squares from your original set of equations to be able to minimize a magnitude and try to find the solution.
As you can see from the second example, you are also free to introduce constraints on the value ot Theta1, Theta2 and t if needed for your system.
Study all the details of NMinimize in the help page and click on all the tabs and little triangles to see additional hidden information.
You can also put the NMinimize inside a Table[] function and use the iteration value of the Table to define the constraints for each solution you desire.

The problem with this approach is that there are many local minima that NMinimize is happy to find, thus a non-zero sum of squares.
Perhaps if you work with the constraints enough you can find real solutions to your system, possibly by doing a large table with small increments in time and then selecting the results that have a very small SumOfSqr.
I had expected and hoped that this approach would be better at easily finding real solutions for your system.
Perhaps your actual functions for Theta1 and Theta2 will provide much better results.
POSTED BY: Bill Simpson
Thanks Mr. Bill Simpson for your comprehensive analysis and  the hard work that you put in my the solution of my problem.

Ah, to elaborate the sitaution, these equations are a set of non-linear trancidenetal equations with unknown functions ?1 and ?2 corresponding to the two angles of the 
two links manipulator. To find the single values for the angles is actually not the desired solution, since when the links of the manipulator moves, the angles do change. hence, the solution of angles ?1 and ?2 is required as a function of time, which will be plotted in some certain time range. resultantly, velocity and acceleration graphs will also be achiveable from the angles.

I hope, now it will be helpful for you and you can try to get me out of this difficult situation.

thanks a lot again
POSTED BY: Muhammad Farid
eqns = {
2 Cos[?1[t]] - 1.5 Sin[?1[t]] == 0.08 Cos[?2[t]]^2 - 0.08 Sin[?2[t]]^2 +0.05/?1 Cos[?1/2[t]],
2 Sin[?1[t]] + 1.5 Cos[?1[t]] == 2* 0.08 Cos[?2[t]] Sin[?2[t]] + Sin[?1/2[t]]
};

The equations are actually to be written like this. Now, I hope you can help me get out of this trouble

thanks bro
POSTED BY: Muhammad Farid
Hello Mr. Frank

No these are not differential equations. these are equations of two links of a robotic arm (manipulator). our job is to solve these equations for angles  ?1 and  ?2 which are changing with respect to time. i mean, the angles are a function of time. with every delta time, the values will change because of the movements of the links. you can define that time range and the instant value (delta time) so that we can get a lot of values for the angles at every time instant and plot the graphs.

i hope it will work now.

thanks
POSTED BY: Muhammad Farid
Also, I don't see any time derivatives. 
POSTED BY: Frank Kampas
Are you saying these are differential equations?  In that case, you should use NDSolve, not Solve.
POSTED BY: Frank Kampas
eqns = {2 Cos[\[Theta]1] - 1.5 Sin[\[Theta]1] ==
    0.08 Cos[\[Theta]2]^2 - 0.08 Sin[\[Theta]2]^2 +
     0.05/\[Theta]1 Cos[\[Theta]1/2],
   2 Sin[\[Theta]1] + 1.5 Cos[\[Theta]1] ==
    2* 0.08 Cos[\[Theta]2] Sin[\[Theta]2] + Sin[\[Theta]1/2]};
FindRoot[eqns, {{\[Theta]1, .1}, {\[Theta]2, 1}}]
{\[Theta]1 -> 0.027134, \[Theta]2 -> 3.93797}
I'm not sure I interpreted your equations correctly.  Also, a different starting point may give a different solution.
POSTED BY: Frank Kampas
Thanks Mr. Frank for your effort.

Yes, there is a little confusion still so i should clarify that for better understanding for you to help me.

it is actually the inverse kinematic equations of a two link manipulator. having angles ?1 and ?2, L1 and L2 respectively. both the links are mobile so the values of the angles changes with the period of time. hence, SINCE THE ?1 AND ?2 ARE FUNCTIONS OF TIME i.e. ?1 and ?2, THEIR VALUES FOR A RANGE OF TIME IS DESIRED AND THEN PLOTS ARE NEEDED TO BE GRAPHED FOR THEM. 

i do hope, that now you have got what i need and i am looking forward for a reply.

thanks again
POSTED BY: Muhammad Farid
Thanks Mr. Franks
To tell you that i AM NEW TO MATHEMATICA AND THIS COMMUNITY. SO NOT AWARE OF MANY THINGS LIKE HOW TO WRITE IT HERE.

ANYWAY, now i have re-written here in this format. i request if YOU CAN KINDLY WRITE IT BY YOURSELF IN MATHEMATICA AND TRY TO FIND OUT A SOLUTION FOR "?1" and 
"?2". 
i will be highly relieved as my phd research is halted by this issue. thanks again for your sincere efforts and suggessions.

2cos ?1-1.5sin ?1=.08 (?cos ?2?^2 )-.08(?sin ?2?^2 )+(.05)/?1 (cos ( ?1/2))……………………………….(1)
2sin ?1+1.5cos ?1=2(.08cos ?2 sin ?2)+ sin(?1/2)........................................................................................................(2)
POSTED BY: Muhammad Farid
Suggest you rewrite the code without the subscripts, using [ ] instead.  That will make it easier for us to figure out what's going on.
POSTED BY: Frank Kampas
Posted 11 years ago
If you change all your Subscript[?, 1][ t ] to ?1, all your Subscript[L, 2] to L2, etc. then you might have a better chance at getting this to work, but even after that I was not able to find a solution. It is possible, sometimes using TrigReduce, to combine several of your trig functions into a single trig function. That might help simplify the problem, but I was not able to get all your trig functions to do that. The hope was if the problem could be simplified enough that there might be a solution found.
POSTED BY: Bill Simpson
Thanks Mr. SImpson for your elaborated reply. i have tried a few ways to simplify the equations like to use a power series function etc, but so far i am not succeeded.

anyway, thanks a lot
POSTED BY: Muhammad Farid
Thanks Mr. Frank Kampas

I will try to check it and edit again, i will be thankful for any help that you can give.

thanks again 
POSTED BY: Muhammad Farid
Hello Mr Frank

I tried it by running it in my own laptop, now it will not give you any error. you can replace the command "Solve" in your own choice.

Thanks

waiting for any help
POSTED BY: Muhammad Farid
I copied your equations in Mathematica 9 and got a syntax error.
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract