Math 112 Matlab #2

Math 112 Matlab #2 - ) Figure 1: Figure 2: Bonus Code:...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Ashay Mehta Math 112 – Calculus II Matlab Assignment #2 Professor Levy Code: figure(1);clf; x=[-1: .01:3]; y=log(1+x); P2=x-x.^2./2 P3=x-x.^2./2+x.^3./3; figure(1);clf; plot(x,y,x,P2, '--' ,x,P3, '-.' ) legend( 'log(1+x)' , 'P_2' , 'P_3' ) xlabel( 'x' ) title( 'The function and the 2^{nd} and 3^{rd} order Taylor Polynomials' ) figure(2);clf; plot(x,abs(y-P2),x,abs(y-P3), '--' ) legend( '|1./(1+x.^2)-P_2|' , '|log(1+x)-P_3|' ) xlabel( 'x' ) title( 'Errors in the two Taylor Polynomials'
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ) Figure 1: Figure 2: Bonus Code: figure(1);clf; x=[-1: .01:3]; y=log(1+x); P2=x-x.^2./2; P3=x-x.^2./2+x.^3./3; P5=x-x.^2./2+x.^3./3-x.^4./4+x.^5./5; figure(1);clf; plot(x,y,x,P2, '--' ,x,P3, '-.' ,x,P5, '*' ) legend( 'log(1+x)' , 'P_2' , 'P_3' , 'P_5' ) xlabel( 'x' ) title( 'The function and the 2^{nd}, 3^{rd}, and 5^{th} order Taylor Polynomials' )...
View Full Document

Page1 / 3

Math 112 Matlab #2 - ) Figure 1: Figure 2: Bonus Code:...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online