- #1
ialan731
- 25
- 0
Homework Statement
Okay, so I need some help with this Matlab program. I never learned Matlab, so I'm trying to do it as best as I can. The question is: Calculate the 2nd and 3rd degree Taylor polynomials for the function f(x)=ln(1+x) about the point a=0 Plot these polynomials and the function on the interval -1<x<3
Homework Equations
N/A
The Attempt at a Solution
This is what I have so far. I thought it was right, but Matlab said "Not enough input arguments." What does that mean, and I how do I fix it?
>> 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 ^{rd} order Taylor Polynomials')
figure(2);clf
plot(x,abs(y-P2),x,abs(y-P3),'--')
legend('log*(1+x)-P_2|','log*(1+x)-P_3|')
xlabel('x')
title('Errors in the two Taylor Polynomials')
Thanks in advance!:)