Animate Tangent, Normal, Binormal vectors?

12 ビュー (過去 30 日間)
Brent Strunk
Brent Strunk 2016 年 10 月 6 日
回答済み: Giovanni Mottola 2016 年 10 月 6 日
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?

採用された回答

Giovanni Mottola
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)
I cannot upload the video, but you can see a .gif version here: http://imgur.com/vJc4d3d

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by