z1=0.5;         %since the height of the cylinder is 1
x1=-1.5;
y1=1.5;

%getting random trajectory 
R2=3;           % R2 is the length of the trajectory. same as before. 
theta=0.01234;  % calcualted value 
Phi= pi/4;      % to make cos(phi) and sin(phi) same 
x2= R2*sin(theta)*cos(Phi);
y2= R2*sin(theta)*sin(Phi);
z2= R2*cos(theta);