function [Jt_array,theta0_list,theta1_list,theta2_list]=simulate

% Caracteristicas da perna
    % Massa dos elos
M1=45;
M2=45;
    % Distancia ao centro de massa dos elos
R1=47;
R2=47;
    % Comprimento dos elos
L1=95;
L2=95;

theta0_list=[-20:20];
theta1_list=[0:180];
theta2_list=[-90:90];

% Array multidimensional
Jt_array=zeros(3,3,length(theta0_list),length(theta1_list),length(theta2_list));

for i0=1:length(theta0_list);
    theta0=theta0_list(i0);
    
    fprintf('\ttheta0=%d\n',theta0);

    for i1=1:length(theta1_list);
        theta1=theta1_list(i1);
        
        for i2=1:length(theta2_list);
            theta2=theta2_list(i2);
            
            % Jacobiano Transposto
            S12=((M1*R1+M2*L1)*seno(theta1)+M2*R2*seno(theta1+theta2))/(M1+M2);
            C12=((M1*R1+M2*L1)*coseno(theta1)+M2*R2*coseno(theta1+theta2))/(M1+M2);
            S2 = M2*R2*seno(theta1+theta2)/(M1+M2);
            C2 = M2*R2*coseno(theta1+theta2)/(M1+M2);

            J11=floor(S12*coseno(theta0)/10000);
            J21=0;
            J31=floor(-S12*seno(theta0)/10000);
            J12=floor(C12*seno(theta0)/10000);
            J22=floor(-S12/10);
            J32=floor(C12*coseno(theta0)/10000);
            J13=floor(C2*seno(theta0)/10000);
            J23=floor(-S2/10);
            J33=floor(C2*coseno(theta0)/10000);

            Jt=[J11 J21 J31;
                J12 J22 J32;
                J13 J23 J33];
            
            % Armazenamento do Jacobiano transposto
            Jt_array(:,:,i0,i1,i2)=Jt;
        end
    end
end

function res=seno(x)
res=round(sin(x*pi/180)*1000);

function res=coseno(x)
res=round(cos(x*pi/180)*1000);