Code for generating the curve and the position vectors
%
Position Vectors
%
Dr. P.Venkataraman
%
t
= 0 :1: 21; % create a vector (MATLAB
termnilogy)
%
from 0 to 20 in steps of 1
x =
1 + t;
y
= 3 + sqrt(t);
z
= 2 + t.*t; % the period
is necessary for
%
element by element multiplication
plot3(x,y,z)
for
i = 1:10:21;
l = line([0
x(i)], [0 y(i)],[0 z(i)]); % draw line
from origin
% to the point P(x,y,z) - 3 lines will be drawn
% they are position vectors as in this version
% we cannot draw arrows
set(l,'Color','r','LineWidth',2);
end
grid
xlabel('x');
ylabel('y');
zlabel('z');
view(37.5,30)
grid