function s = nTermSine5(x,maxterms) % nTermSine4 Evaluate series approximation to sin(x). Use recursive % evaluation of terms, while loop, convergence check and limit % maximum number of terms % % Synopsis: s = nTermSine5(x,n) % % Input: x = argument of sine(x) % maxterms = maximum number of terms in the series % % Output: s = approximation to sin(x) with a max of n terms. Stop when % abs(term/sum) < tol, where tol = 5e-6 term = x; s = term; % initialize the sum and the sign of the term tol = 5e-6; fprintf('\n i term s\n'); fprintf(' %4d %18.13f %8.5f\n',1,term,s); i = 1; n=1; while abs(term/s)>tol && n