% eda11_01
% example of a Taylor Series
% using the function
% 1/(1-x) = 1 + x + x^2 + x^3 + ...
clear all;

N = 101;
tmin = -1.2;
tmax = 0.8;
Dt = (tmax-tmin)/(N-1);
t = tmin+Dt*[0:N-1]';


figure(1);
clf;
set(gca,'LineWidth',2);
hold on;
axis([tmin,tmax,0,2]);
hold on;
xlabel('t');
ylabel('y(t)');

y = 1./(1-t);
plot(t,y,'-','LineWidth',7,'Color',[0.8,0.8,0.8]);

t0=0;
y0=1./(1-t0);
plot(t0,y0,'ko','LineWidth',2);

y1 = 1+t;
plot(t,y1,'k:','LineWidth',2);

y2 = 1+t+t.^2;
plot(t,y2,'k--','LineWidth',1.5);

y3 = 1+t+t.^2+t.^3;
plot(t,y3,'k-','LineWidth',3);
