test_31 - i = i+1 end e fprintf('i true appprox error\n') f...

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

View Full Document Right Arrow Icon
function test_31(x,nterms) f i =1; i cosx=0; c cosxtrue = cos(x); c while i<=nterms dcosx = cosx = cosx + dcosx; perror = ((cosxtrue - cosx)/cosxtrue)*100;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: i = i+1 end e fprintf('i true appprox error\n') f fprintff('%2d %9.6f %9.6f %8.2f\n', i cosxtrue, f...
View Full Document

Ask a homework question - tutors are online