# Question:A Gigantic Matrix how to convert it to matlab code without getting error

## Question:A Gigantic Matrix how to convert it to matlab code without getting error

Maple 13

I have a problem changing a maple matrix to a matlab code without getting the error

Error, (in PrintTarget) assigning to a long list, please use Arrays ( I don't know how to use arrays ) thanks Big in advance

Here is my code:

> J[p1] := Matrix(3, 4, {(1, 1) = -sin(theta[1](t))*`&Delta;x`[1]-cos(theta[1](t))*`&Delta;z`[1], (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = cos(theta[1](t))*`&Delta;x`[1]-sin(theta[1](t))*`&Delta;z`[1], (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = (1/2)*rho*cos((1/2)*theta[1](t)), (3, 2) = 0, (3, 3) = 0, (3, 4) = 0});
> J[o1] := Matrix(3, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0});
> J[p2] := Matrix(3, 4, {(1, 1) = -sin(theta[1](t))*a[2]*cos(theta[2](t))-cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))-sin(theta[1](t))*cos(theta[2](t))*`&Delta;x`[2]-sin(theta[1](t))*sin(theta[2](t))*`&Delta;y`[2]+cos(theta[1](t))*`&Delta;z`[2], (1, 2) = -cos(theta[1](t))*a[2]*sin(theta[2](t))-(1/2)*sin(theta[1](t))*rho*cos((1/2)*theta[2](t))-cos(theta[1](t))*sin(theta[2](t))*`&Delta;x`[2]+cos(theta[1](t))*cos(theta[2](t))*`&Delta;y`[2], (1, 3) = 0, (1, 4) = 0, (2, 1) = cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+cos(theta[1](t))*cos(theta[2](t))*`&Delta;x`[2]+cos(theta[1](t))*sin(theta[2](t))*`&Delta;y`[2]+sin(theta[1](t))*`&Delta;z`[2], (2, 2) = -sin(theta[1](t))*a[2]*sin(theta[2](t))+(1/2)*cos(theta[1](t))*rho*cos((1/2)*theta[2](t))-sin(theta[1](t))*sin(theta[2](t))*`&Delta;x`[2]+sin(theta[1](t))*cos(theta[2](t))*`&Delta;y`[2], (2, 3) = 0, (2, 4) = 0, (3, 1) = (1/2)*rho*cos((1/2)*theta[1](t)), (3, 2) = -a[2]*cos(theta[2](t))-cos(theta[2](t))*`&Delta;x`[2]-sin(theta[2](t))*`&Delta;y`[2], (3, 3) = 0, (3, 4) = 0});
> J[o2] := Matrix(3, 4, {(1, 1) = 0, (1, 2) = -sin(theta[1](t)), (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = cos(theta[1](t)), (2, 3) = 0, (2, 4) = 0, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0});
>
> J[3] := Matrix(6, 4, {(1, 1) = cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))-cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))-sin(theta[1](t))*a[2]*cos(theta[2](t))+(-sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;x`[3]-cos(theta[1](t))*`&Delta;y`[3]+(sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;z`[3], (1, 2) = (cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;x`[3]-cos(theta[1](t))*a[2]*sin(theta[2](t))-(1/2)*sin(theta[1](t))*rho*cos((1/2)*theta[2](t))+(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[3], (1, 3) = (1/2)*sin(theta[1](t))*rho*cos((1/2)*theta[3](t))+(-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;x`[3]+(-cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[3], (1, 4) = 0, (2, 1) = sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;x`[3]-sin(theta[1](t))*`&Delta;y`[3]+(-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;z`[3], (2, 2) = (sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;x`[3]-sin(theta[1](t))*a[2]*sin(theta[2](t))+(1/2)*cos(theta[1](t))*rho*cos((1/2)*theta[2](t))+(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[3], (2, 3) = -(1/2)*cos(theta[1](t))*rho*cos((1/2)*theta[3](t))+(-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;x`[3]+(-sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[3], (2, 4) = 0, (3, 1) = (1/2)*rho*cos((1/2)*theta[1](t)), (3, 2) = -a[2]*cos(theta[2](t))+(-cos(theta[2](t))*cos(theta[3](t))-sin(theta[2](t))*sin(theta[3](t)))*`&Delta;x`[3]+(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[3], (3, 3) = (sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*`&Delta;x`[3]+(sin(theta[2](t))*cos(theta[3](t))-cos(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[3], (3, 4) = 0, (4, 1) = 0, (4, 2) = -sin(theta[1](t)), (4, 3) = sin(theta[1](t)), (4, 4) = 0, (5, 1) = 0, (5, 2) = cos(theta[1](t)), (5, 3) = -cos(theta[1](t)), (5, 4) = 0, (6, 1) = 1, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0});
> J[p3] := J[3][1 .. 3, 1 .. 4];
> J[o3] := J[3][4 .. 6, 1 .. 4];
> J[4] := Matrix(6, 4, {(1, 1) = cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+(sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+((-sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))-cos(theta[1](t))*sin(theta[4](t)))*`&Delta;x`[4]-cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+(-(-sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))-cos(theta[1](t))*cos(theta[4](t)))*`&Delta;y`[4]-sin(theta[1](t))*a[2]*cos(theta[2](t))+(sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;z`[4], (1, 2) = (cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-(cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*sin(theta[4](t))*`&Delta;y`[4]+(cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*cos(theta[4](t))*`&Delta;x`[4]+(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[4]-cos(theta[1](t))*a[2]*sin(theta[2](t))-(1/2)*sin(theta[1](t))*rho*cos((1/2)*theta[2](t)), (1, 3) = (-cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+(-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*cos(theta[4](t))*`&Delta;x`[4]+(1/2)*sin(theta[1](t))*rho*cos((1/2)*theta[3](t))-(-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*sin(theta[4](t))*`&Delta;y`[4]+(-cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[4], (1, 4) = (-(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))+sin(theta[1](t))*sin(theta[4](t)))*`&Delta;y`[4]+(-(1/2)*cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+(1/2)*cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*rho*cos((1/2)*theta[4](t))+(-(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))-sin(theta[1](t))*cos(theta[4](t)))*`&Delta;x`[4], (2, 1) = (-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+((cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))-sin(theta[1](t))*sin(theta[4](t)))*`&Delta;x`[4]+(-(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))-sin(theta[1](t))*cos(theta[4](t)))*`&Delta;y`[4]+(-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`&Delta;z`[4], (2, 2) = (sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-(sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*sin(theta[4](t))*`&Delta;y`[4]+(sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*cos(theta[4](t))*`&Delta;x`[4]+(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[4]-sin(theta[1](t))*a[2]*sin(theta[2](t))+(1/2)*cos(theta[1](t))*rho*cos((1/2)*theta[2](t)), (2, 3) = (-sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+(-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*cos(theta[4](t))*`&Delta;x`[4]-(1/2)*cos(theta[1](t))*rho*cos((1/2)*theta[3](t))-(-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*sin(theta[4](t))*`&Delta;y`[4]+(-sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))-sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[4], (2, 4) = (-(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))-cos(theta[1](t))*sin(theta[4](t)))*`&Delta;y`[4]+(-(1/2)*sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+(1/2)*sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*rho*cos((1/2)*theta[4](t))+(-(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))+cos(theta[1](t))*cos(theta[4](t)))*`&Delta;x`[4], (3, 1) = (1/2)*rho*cos((1/2)*theta[1](t)), (3, 2) = (-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-a[2]*cos(theta[2](t))-(-cos(theta[2](t))*cos(theta[3](t))-sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))*`&Delta;y`[4]+(-cos(theta[2](t))*cos(theta[3](t))-sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))*`&Delta;x`[4]+(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[4], (3, 3) = (sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*cos(theta[4](t))*`&Delta;x`[4]+(sin(theta[2](t))*cos(theta[3](t))-cos(theta[2](t))*sin(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+(sin(theta[2](t))*cos(theta[3](t))-cos(theta[2](t))*sin(theta[3](t)))*`&Delta;z`[4]-(sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*sin(theta[4](t))*`&Delta;y`[4], (3, 4) = -(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))*`&Delta;y`[4]+((1/2)*sin(theta[2](t))*sin(theta[3](t))+(1/2)*cos(theta[2](t))*cos(theta[3](t)))*rho*cos((1/2)*theta[4](t))-(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))*`&Delta;x`[4], (4, 1) = 0, (4, 2) = -sin(theta[1](t)), (4, 3) = sin(theta[1](t)), (4, 4) = -cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (5, 1) = 0, (5, 2) = cos(theta[1](t)), (5, 3) = -cos(theta[1](t)), (5, 4) = -sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (6, 1) = 1, (6, 2) = 0, (6, 3) = 0, (6, 4) = sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t))});
> J[p4] := J[4][1 .. 3, 1 .. 4];
> J[o4] := J[4][4 .. 6, 1 .. 4];
> ner[l1] := Matrix(3, 3, {(1, 1) = e[l1xx], (1, 2) = -e[l1xy], (1, 3) = -e[l1xz], (2, 1) = e[l1xy], (2, 2) = e[l1yy], (2, 3) = -e[l1yz], (3, 1) = e[l1xz], (3, 2) = e[l1yz], (3, 3) = e[l1zz]});
> ner[l2] := Matrix(3, 3, {(1, 1) = e[l2xx], (1, 2) = -e[l2xy], (1, 3) = -e[l2xz], (2, 1) = e[l2xy], (2, 2) = e[l2yy], (2, 3) = -e[l2yz], (3, 1) = e[l2xz], (3, 2) = e[l2yz], (3, 3) = e[l2zz]});
> ner[l3] := Matrix(3, 3, {(1, 1) = e[l3xx], (1, 2) = -e[l3xy], (1, 3) = -e[l3xz], (2, 1) = e[l3xy], (2, 2) = e[l3yy], (2, 3) = -e[l3yz], (3, 1) = e[l3xz], (3, 2) = e[l3yz], (3, 3) = e[l3zz]});
> ner[l4] := Matrix(3, 3, {(1, 1) = e[l4xx], (1, 2) = -e[l4xy], (1, 3) = -e[l4xz], (2, 1) = e[l4xy], (2, 2) = e[l4yy], (2, 3) = -e[l4yz], (3, 1) = e[l4xz], (3, 2) = e[l4yz], (3, 3) = e[l4zz]});
> with(LinearAlgebra);
> J[p1t] := Transpose(J[p1]);
> J[p2t] := Transpose(J[p2]);
> J[p3t] := Transpose(J[p3]);
> J[p4t] := Transpose(J[p4]);
> J[o1t] := Transpose(J[o1]);
> J[o2t] := Transpose(J[o2]);
> J[o3t] := Transpose(J[o3]);
> J[o4t] := Transpose(J[o4]);
> R[1] := Matrix(3, 3, {(1, 1) = cos(theta[1](t)), (1, 2) = 0, (1, 3) = -sin(theta[1](t)), (2, 1) = sin(theta[1](t)), (2, 2) = 0, (2, 3) = cos(theta[1](t)), (3, 1) = 0, (3, 2) = -1, (3, 3) = 0});
> R[t1] := Transpose(R[1]);
> R[2] := Matrix(3, 3, {(1, 1) = cos(theta[1](t))*cos(theta[2](t)), (1, 2) = cos(theta[1](t))*sin(theta[2](t)), (1, 3) = sin(theta[1](t)), (2, 1) = sin(theta[1](t))*cos(theta[2](t)), (2, 2) = sin(theta[1](t))*sin(theta[2](t)), (2, 3) = -cos(theta[1](t)), (3, 1) = -sin(theta[2](t)), (3, 2) = cos(theta[2](t)), (3, 3) = 0});
> R[t2] := Transpose(R[2]);
> R[3] := Matrix(3, 3, {(1, 1) = cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)), (1, 2) = -sin(theta[1](t)), (1, 3) = -cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (2, 1) = sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)), (2, 2) = cos(theta[1](t)), (2, 3) = -sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (3, 1) = -sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)), (3, 2) = 0, (3, 3) = sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t))});
> R[t3] := Transpose(R[3]);
> R[4] := Matrix(3, 3, {(1, 1) = (cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))-sin(theta[1](t))*sin(theta[4](t)), (1, 2) = -(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))-sin(theta[1](t))*cos(theta[4](t)), (1, 3) = -cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (2, 1) = (sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))+cos(theta[1](t))*sin(theta[4](t)), (2, 2) = -(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))+cos(theta[1](t))*cos(theta[4](t)), (2, 3) = -sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (3, 1) = (-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t)), (3, 2) = -(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t)), (3, 3) = sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t))});
> R[t4] := Transpose(R[4]);
> B := m[1]*J[p1t].J[p1]+J[o1t].R[1].ner[l1].R[t1].J[o1]+m[2]*J[p2t].J[p2]+J[o2t].R[2].ner[l2].R[t2].J[o2]+m[3]*J[p3t].J[p3]+J[o3t].R[3].ner[l3].R[t3].J[o3]+m[4]*J[p4t].J[p4]+J[o4t].R[4].ner[l4].R[t4].J[o4];
> n := 4;
> Cmatrix := Matrix(n); for i to n do for j to n do for k to n do Cmatrix[i, j] := Cmatrix[i, j]+(1/2*(coeff*(map(diff, B[i, j], t), diff(theta[k](t), t))+coeff(map(diff, B[i, k], t), diff(theta[j](t), t))-coeff(map(diff, B[j, k], t), diff(theta[I](t), t))))*(diff(theta[k](t), t)) end do end do end do;
>
> Gr := Vector(3, {(1) = 0, (2) = 0, (3) = g});
Vector[column](%id = 244529404)
> Grt := Transpose(Gr);
Vector[row](%id = 220948792)
> Grv := m[1]*Grt.J[p1]+m[2]*Grt.J[p2]+m[3]*Grt.J[p3]+m[4]*Grt.J[p4];
>
> GrvT := Transpose(Grv);
print(`output redirected...`); # input placeholder
> with(CodeGeneration);
print(`output redirected...`); # input placeholder
>
> Matlab;
> Matlab(B, optimize);
%;
Warning, the function names {`theta[1]`, `theta[2]`, `theta[3]`, `theta[4]`} are not recognized in the target language
Error, (in PrintTarget) assigning to a long list, please use Arrays
> NULL;
%;
>

﻿