# Forward Kinematics Frame Simulation in MATLAB

I've worked out the T matrix of the tip (position and orientation) with respect to the base frame of a 6 DoF robot for 2 seconds at 1kHz.

So the size of the total T matrix is 4*4*1000.

How can I animate it with MATLAB? Just simple simulation showing the tip frame movement. Like this (not necessary showing the position in numbers):

from here

Thanks.

suppose you calculate the positions of your joints $$p_i, i=1\ldots6$$ using your homogeneous matrices.

The best solution in my experience is to plot the initial configuration e.g. like this:

// calc p for time t=0
f=figure(1);
plot3([0, p_1(1)], [0, p_1(2)], [0, p_1(3)]);
hold on;
plot3([p_1(1), p_2(1)], [p_1(2), p_2(2)], [p_1(3), p_2(3)])


the thing is now, if you want to have a smooth animation, it is a bad idea to call the plot command each time because it needs some time. The better solution is to update the coordinates of your figure.

// in a for loop i=1:length of you time vector
// calc p for time t=i*deltaT
set(f.Children(x), 'XData', [p_1(1), p_2(1)], 'YData', [p_1(2), p_2(2)], 'ZData', [p_1(3), p_2(3)])


where you have to figure out the correct child of you figure handle f, you can just hop trough the structure of f to find the right children.