function S = SinSeries1(x, n) % function S = SinSeries1(x, n) % This function determines the value of the sine based on a series % expansion. % S. Scott Moor April 2008 % % Input variables: x = angle (radiuns) % n = number of terms in the series approximation % Output variable: S = the resulting estimate of sin (unitless) % Other variables k = loop index, location of the current term % t = an intermedeate value used in the series calculation % initialize the series with its first term, S = n; % Add each sucessive term using a for loop for k = 1:n t = k*2-1; S = [S,(-1)^(k+1)*x^t./(factorial(t))]; end