Message Boards Message Boards

0
|
2916 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Perform the iterative jacobian method with while loop?

Posted 4 years ago

I'm trying to do the iterative jacobian method but I can't get the output

* Let' s do the Iterative Jacobian Method! *)
counter = 1; loopiter = 5;
While[True,
\[Theta]est = {Part[\[Theta]i, 1, 1], Part[\[Theta]i, 2, 1], 
Part[\[Theta]i, 3, 1]};
\[Theta]1 = Part[\[Theta]est, 1, 1]; \[Theta]2 = 
Part[\[Theta]est, 2, 1]; \[Theta]3 = Part[\[Theta]est, 3, 1];
pnew = p0T;
dP = pG - pnew;
Jnew = J0trans;
d\[Theta] = Inverse (Jnew).dP;
\[Theta]i = \[Theta]est + d\[Theta];
If[counter > loopiter, Break[]]; counter++
];
Print["\[Theta]i = ", MatrixForm[\[Theta]i]]

WHERE

    p0T = (Cos[\[Theta]1] (0.3 +Cos[\[Theta]2] (0.3 +0.15 Cos[\[Theta]3])-0.15 Sin[\[Theta]2] Sin[\[Theta]3])
    Sin[\[Theta]1] (0.3 +Cos[\[Theta]2] (0.3 +0.15 Cos[\[Theta]3])-0.15 Sin[\[Theta]2] Sin[\[Theta]3])
    0.3 Sin[\[Theta]2]+0.15 Sin[\[Theta]2+\[Theta]3]
    1.
    pG = {0.35, 0.05, 0.35}

    J0trans = (-Sin[\[Theta]1] (0.3 +Cos[\[Theta]2] (0.3 +0.15 Cos[\[Theta]3])-0.15 Sin[\[Theta]2] Sin[\[Theta]3])  Cos[\[Theta]1] (-(0.3 +0.15 Cos[\[Theta]3]) Sin[\[Theta]2]-0.15 Cos[\[Theta]2] Sin[\[Theta]3])   Cos[\[Theta]1] (-0.15 Cos[\[Theta]3] Sin[\[Theta]2]-0.15 Cos[\[Theta]2] Sin[\[Theta]3])
    Cos[\[Theta]1] (0.3 +Cos[\[Theta]2] (0.3 +0.15 Cos[\[Theta]3])-0.15 Sin[\[Theta]2] Sin[\[Theta]3])  Sin[\[Theta]1] (-(0.3 +0.15 Cos[\[Theta]3]) Sin[\[Theta]2]-0.15 Cos[\[Theta]2] Sin[\[Theta]3])   Sin[\[Theta]1] (-0.15 Cos[\[Theta]3] Sin[\[Theta]2]-0.15 Cos[\[Theta]2] Sin[\[Theta]3])
    0   0.3 Cos[\[Theta]2]+0.15 Cos[\[Theta]2+\[Theta]3]  0.15 Cos[\[Theta]2+\[Theta]3]

)

)
POSTED BY: Anshuman Singh

You never define \[Theta]i, and your WHERE code does not parse in a sensible way.

POSTED BY: Gianluca Gorni
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