I have digitized a video of a flying insect.
I have the x,y,z co-ordinates of the insects head and I have the x,y,z co-ordinates of the insects tail-end.
I can make two different scatter3 plots --- one of the head and the other of the tail.
But I want to combine these two scatter3 plots in such a way that, in the new scatter plot, the head and the tail are joined by a line.
It must be very easy to do this?
Yeah, it is very easy to do this. Supposing you have same amount of heads and tails data. Probably there is a more efficient way of coding this, but hey, it works. I encourage anyone with a better coding skills than me to improve it ;)
figure()
hold on
scatter3d(Xhead, Yhead,Zhead ,'fill',[1 0 0])
scatter3d(Xtail, Ytail,Ztail ,'fill',[0 0 1])
for ii=1:length(Xhead)
plot3([Xhead(ii) Xtail(ii)],[Yhead(ii) Ytail(ii)],[Zhead(ii) Ztail(ii)])
end
hold off