function x=n_sinx (n);
%n_sinx (n) : This m-file takes an input n for the number of terms used in a taylor
%expansion of sin (x).  It generates two subplots: one for sin(x) and
%another for [sin(x)-Sn(x)] where Sn(x) is the taylor approximation with n
%terms

x_values=0:.01:2*pi;
taylor_sin=zeros(length(x_values),1);
harmonics=0:1:n;
x=zeros(length(harmonics),1);

for i=1:length(x_values) 
   
    for j=1:harmonics
     x(j)=[(-1)^j*x_values(i)^(2*j-1)]/factorial(2*j-1);
 end;
taylor_sin(i)=sum(x);    
sum(x)
end;
harmonics
