Azzera filtri
Azzera filtri

Animate Tangent, Normal, Binormal vectors?

6 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Giovanni Mottola
Giovanni Mottola il 6 Ott 2016
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

Più risposte (0)

Categorie

Scopri di più su Vector Fields in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by