I figured it out; here is in case anyone else would like to see.
function output = my_sin(x)
x=input('Enter value of x to calculate sin(x): ');
k=1;
n=3;
y(1)=x;
total(1)=y(1);
while k>=0
k=k+1;
y(k)=(((-1)^(k-1))/(factorial(n)))*x^((n));
total(k)=total(k-1)+y(k);
if (abs(total(k)-total(k-1))<=0.001)
break
end
n=n+2;
end
l=length(total);
output = total(l);