clear

syms t
x = cos(t);
y = sin(t);
z = t;


R=[x,y,z]
T=diff(R);
n=diff(T)
B=cross(T,n)
N=cross(B,T)

tt=linspace(-pi,0,100);
xx=subs(R(1),{t},{tt});
yy=subs(R(2),{t},{tt});
zz=subs(R(3),{t},{tt});
plot3(xx,yy,zz,'k'), hold on

ttt=linspace(-pi,0,5);
xxx=subs(R(1),{t},{ttt});
yyy=subs(R(2),{t},{ttt});
zzz=subs(R(3),{t},{ttt});

Tx=subs(T(1),{t},{ttt});
Ty=subs(T(2),{t},{ttt});
Tz=subs(T(3),{t},{ttt});
normT=sqrt(Tx.^2+Ty.^2+Tz.^2);
quiver3(xxx,yyy,zzz,Tx./normT,Ty./normT,Tz./normT,0.5,'color','r')

Nx=subs(N(1),{t},{ttt});
Ny=subs(N(2),{t},{ttt});
Nz=subs(N(3),{t},{ttt});
normN=sqrt(Nx.^2+Ny.^2+Nz.^2);
quiver3(xxx,yyy,zzz,Nx./normN,Ny./normN,Nz./normN,0.5,'color','g')

Bx=subs(B(1),{t},{ttt});
By=subs(B(2),{t},{ttt});
Bz=subs(B(3),{t},{ttt});
normB=sqrt(Bx.^2+By.^2+Bz.^2);
quiver3(xxx,yyy,zzz,Bx./normB,By./normB,Bz./normB,0.5,'color','b')
[xxx,yyy,zzz,Bx./normB,By./normB,Bz./normB]
legend('Curve','Tangent','Normal','Binormal'), axis equal