tags:

views:

115

answers:

1

I'm asking the same question of some days ago but now i would like to add at the question one more step.

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 help

A: 

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 
Loïc Février
Thank you for the answer but, could be possible to have the code. I really don't know how to calculate automatically the bisector of the two vector for each position of the moving vector.
vittorio
One easy way to do it : normalize your 2 vectors (norm = 1) then the bisector is simply the sum of your 2 vectors. You can now change it's norm for better visibility.
Loïc Février
Thank you for the help but really i can't compute the bisector of the angle between the two vector.
vittorio
hank you for the help but really i can't compute the bisector of the angle between the two vectors. In the the previous code i added a second vector fixed with the origin in [0 0 0] and and at [0 0 -200]. unfortunately, even if i know how to calculate manually the bisector of the two i can't program the calculation in matlab. what i would like to visualize is the motion of the two vector, the firs in the previous code and the bisector. Any suggestion or, if it is possible, some tips on how to write the code? Thank you
vittorio
In particular, i would like to know how the coordinates of the bisector varies as function of the moving vector, and program this in matlab.
vittorio
My answer is above : compute the bisector with the code I gave and then use a second handler and a second "set(" to modify at each iteration the bisector.
Loïc Février
Still thank you for your help. I will try again using your suggestion. THe only problem i have is that the component of one vector are not numeric but symbolic as [0 t t^2] and i can't calculate the norm directly because the function norm not recognize the command syms.
vittorio
I'm using the normal formula for the norm.
vittorio
Don't use norm of the symbolic form....for each value of t you can have a numeric value....and you can apply the norm.
Loïc Février

related questions