Saket Soni


back to numerical
back to home


% Sin curve using Taylor's Polynomial Method ...
% Author : Saket Soni
% Description : Numerical Assignment for plotting a sin curve using
%               Taylor's Polynomial Method.

x = 0 : 0.1 : 2;            %   x's for which the y's are to be computed

p0 = sin(1);                                %   zero degree polynomial
p1 = p0 + cos(1)*(x-1);                     %   first degree polynomial
p2 = p1 - sin(1)*(x-1).*(x-1)/2;            %   second degree polynomial
p3 = p2 - cos(1)*(x-1).*(x-1).*(x-1)/6;     %   third degree polynomial
p4 = p3 + sin(1)*(x-1).*(x-1).*(x-1)/24;    %   fourth degree polynomial

plot(x,p0,'-.or',...
    'LineWidth',2,...
    'MarkerEdgeColor','r',...
    'MarkerFaceColor',[ .49 1 .63 ],...
    'MarkerSize',2);
hold on;
plot(x,p1,':bs',...
    'LineWidth',2,...
    'MarkerEdgeColor','b',...
    'MarkerFaceColor',[ .49 1 .63 ],...
    'MarkerSize',2);
plot(x,p2,'--g+',...
    'LineWidth',2,...
    'MarkerEdgeColor','g',...
    'MarkerFaceColor',[ .49 1 .63 ],...
    'MarkerSize',5);
plot(x,p3,'-.sc',...
    'LineWidth',2,...
    'MarkerEdgeColor','c',...
    'MarkerFaceColor',[ .49 1 .63 ],...
    'MarkerSize',2);
plot(x,p4,'-.md',...
    'LineWidth',2,...
    'MarkerEdgeColor','m',...
    'MarkerFaceColor',[ .49 1 .63 ],...
    'MarkerSize',2);
hold off;

%plot(x,p0,'-.or','LineWidth',2,x,p1,':b',x,p2,'--g',x,p3,'-c',x,p4,'-.m');
end;




back to numerical
back to home

Locations of visitors to this page 1