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)
MATLAB EXERCISE 5 This exercise focuses on the Jacobian matrix and determinant, simulated resolved-rate control, and...
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-...