main14 - fp = inline('4*log(x)/x+3*cos(x)','x'); f x=...

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

View Full Document Right Arrow Icon
% % Derek Rampal % HW14 % 3b, 3d % clear; c %3b x = [8.1;8.3;8.5;8.7]; x f = inline('x*log(x)','x'); fp = inline('log(x)+1','x'); f h = .2; h threeb(1,1) = ediff3(f,x(1,1),h); threeb(2,1) = mdiff3(f,x(2,1),h); threeb(3,1) = mdiff3(f,x(3,1),h); threeb(4,1) = ediff3(f,x(4,1),-h); t for i=1:4 fprime(i,1)=fp(x(i)); [signif(i,1),eabs(i,1),erel(i,1)] = sigdig(fp(x(i,1)),threeb(i,1)); end; e [fprime,threeb,eabs,erel,signif] [ %3a % f = inline('2*(log(x))^2+3*sin(x)','x');
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fp = inline('4*log(x)/x+3*cos(x)','x'); f x= [2;2.1;2.2;2.3]; h=.1; h threed(1,1) = ediff3(f,x(1,1),h); threed(2,1) = mdiff3(f,x(2,1),h); threed(3,1) = mdiff3(f,x(3,1),h); threed(4,1) = ediff3(f,x(4,1),-h); t for i=1:4 fprime(i,1)=fp(x(i)); [signif(i,1),eabs(i,1),erel(i,1)] = sigdig(fp(x(i,1)),threed(i,1)); end; e [fprime,threed,eabs,erel,signif]...
View Full Document

Ask a homework question - tutors are online