
Animate Tangent, Normal, Binormal vectors?
    조회 수: 7 (최근 30일)
  
       이전 댓글 표시
    
I'm attempting to animate the Tangent, Normal, and Binormal vectors for the curve r(t)=<cos(t),sin(t),t>. I've worked them out by hand, plotted the graph, and can use quiver3 to plot the vectors but I am brand new to animation. Any suggestions for an easy animation?
댓글 수: 0
채택된 답변
  Giovanni Mottola
      
 2016년 10월 6일
        I will assume you have already plotted the curve described by your equation (an helix), by calculating "npo" points on the helix. The plot should be something like this:

Then use the following code:
hold on  %   tells MATLAB to add quiver3 plot to current figure
for i=1:npo
   %   calculation of the tangent, normal and binormal vectors. Note this is done for the i-th point    
   %   of your helix (that is, for p(i)=[x(i), y(i), z(i)])
   v=[-R*sin(alpha(i)), R*cos(alpha(i)), h/(2*pi)];
   v=v/norm(v);
   b=[R*h/(2*pi)*sin(alpha(i)), -R*h/(2*pi)*cos(alpha(i)), R^2];
   b=b/norm(b);
   n=cross(b, v);
   n=n/norm(n);
   %   add quiver3 plot of the three 3D vectors
   quiver3(x(i), y(i), z(i), v(1), v(2), v(3), 'r');
   quiver3(x(i), y(i), z(i), b(1), b(2), b(3), 'b');
   quiver3(x(i), y(i), z(i), n(1), n(2), n(3), 'g');
   %   save the current figure as a movie "frame"
   movie_frames(i)=getframe(gcf);
   %   find all Quiver objects in current figure and delete them (otherwise, with "hold on", we'd
   %   keep adding arrows on the plot)
   res=findobj(gca, 'Type', 'Quiver');
   res(1).delete
   res(2).delete
   res(3).delete
end
To view the resulting video, call
movie(gcf, movie_frames)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

