problem 3_1 - error = ((true-series)/true)*100;...

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; x=1.5; 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 %14.5f %12.5f\n',i,true,series,error); i=i+1 compsin(1.5,8) end...
View Full Document

This note was uploaded on 09/20/2009 for the course CIVL 3010 taught by Professor Melville during the Spring '09 term at Auburn University.

Ask a homework question - tutors are online