problem3_1 - error = (true-series)/true*100; fprintf('%3d...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%problem 3.1 function compsin(x,n) i = 1; true = sin(x); series = 0; fprintf('\n'); fprintf('order true value approx error\n'); while (1) if i > n, break, end series = series+(-1)^(i-1)*x^(2*i-1)/(factorial(2*i-1);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: error = (true-series)/true*100; fprintf('%3d %14.5f %12.5f/n',i,true,series,error); i = i+1; end...
View Full Document

Ask a homework question - tutors are online