Question

MATLAB EXERCISE 5 This exercise focuses on the Jacobian matrix and determinant, simulated resolved-rate control, and inverse
Jacobian matrix with the new configuration new before completing the resolved-rate calculations for the next time step. Devel
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code function x = my_jacobi(A, b, tot_it) Function Input for the function SA - Matrix input $b - Vector input $tot_it - Numbex old = x; &End of for loop() end End of function end Sample input for the function A=[4 -2 0; -2.6 -2; 0 -2 4]; b=[2;8; -10]Executable Code
function x = my_jacobi(A, b, tot_it) %Function
  
   %Input for the function
   %A - Matrix input
   %b - Vector input
   %tot_it - Number of iterations
  
   %Output of the function
   %x - Solution after tot_it number of iterations
  
   %Length of matrix
   lenOfMatrix = length(A);
  
   %Compute x
   x = zeros(lenOfMatrix,1);
  
   %Variable to store total
   total = 0;
  
   %Update x_Old
   x_Old = x
  
   %For loop()
   for idx3 = 1:tot_it
      
       %For loop()
       for idx1 = 1:lenOfMatrix
          
           %For loop()
           for idx2 = 1:lenOfMatrix
              
               %Condition check
               if (idx2 ~= idx1)
              
                   %Update total
                   total = total + (A(idx1,idx2)/A(idx1,idx1)) * x_Old(idx2);
              
               %Otherwise
               else
              
                   %Continue
                   continue;
              
               %End of condition
               end
              
           %End of for loop()
           end
           x(idx1) = -total + b(idx1)/A(idx1,idx1);
           total = 0;
      
       %End of for loop()
       end
       x_Old = x;
  
   %End of for loop()
   end
%End of function
end

%Inputs for funtion
A=[4 -2 0; -2 6 -2; 0 -2 4];
b=[2;8;-10];
tot_it=100;
xJacobi = my_jacobi(A,b,tot_it)
xT = A\b

errJacobi = norm(xT - xJacobi)

Add a comment
Know the answer?
Add Answer to:
MATLAB EXERCISE 5 This exercise focuses on the Jacobian matrix and determinant, simulated resolved-rate control, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MATLAB EXERCISE4 This exercise focuses on the inverse-pose kinematics solution for the planar 3-DOF 3R robot...

    MATLAB EXERCISE4 This exercise focuses on the inverse-pose kinematics solution for the planar 3-DOF 3R robot (see Figures 3.6 and 3.7; the DH parameters are given in Figure 3.8). The following fixed-length parameters are given: L-4, L-3, and L3 2(m). a) Analytically derive, by hand, the inverse-pose solution for this robot: Given QT calculate all possible multiple solutions for (01 62 63]. (Three methods are pre- sented in the text-choose one of these.) Hint: To simplify the equations, first cal-...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT