开发者

How i can draw a 3D vector with MATLAB and move it along a parabola?

Below the code for the first step:

t = -20:0.1:20; 
plot3(zeros(size(t)),t,-t.^2);
hold on
i = 1;
h = plot3([0 0],[0 t(i)],[0 -t(i)^2],'r');
for(i=2:length(t))
    set(h,'xdata',[0 0],'ydata',[0 t(i)],'zdata',[0 -t(i)^2]);
    pause(0.01);
end

Now I draw a second vector, fixed in the space, with the same origin of the moving vector, say [0 0 0] and the end at, e.g., [0 0 30]. Than there is an angle between the two vector, having the same origin.

My questions: I would like to calculate the bisector of this angle and show how the bisector moves in the space, in connection to the motion of the first vector.

Thanks for the开发者_C百科 help


Use a new handler (g for example) to store the "plot3" for the bisector.

On each step calculate the bisector equation and use "set" to update the handler g (as you are doing it for h).

EDIT :

To compute the bisector :

U = [1 2 3];
V = [4 5 6];
B = U / norm(U) + V / norm(V);
B = B / norm(U); % Bisector is now of norm 1
B = B * norm(U); % easier for plotting, bisector and U and now equal norms 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜