%________________________________________________________________
%o sistema que estamos usando a sol
clear all
clc

A = [0 1 1 1 1 1 1 1 1 1;
    0 2 4 5 0 1 2 3 4 5;
    0 2 12 20 0 0 2 6 12 20;
    0 0 24 60 0 0 0 6 24 60;
    0 0 24 120 0 0 0 0 24 120;
    1 0 0 0 -1 -2 -4 -8 -16 -32;
    5 0 0 0 0 1 4 12 32 80;
    20 0 0 0 0 0 -2 -12 -48 -160;
    60 0 0 0 0 0 0 6 48 240;
    120 0 0 0 0 0 0 0 -24 -240];
 
 b = [1; 0; 0; 0; 0; 0; 0; 0; 0; 0];
 format rat
 x = A\b;
 resp = A*x; 

 
%  para f(z) = 1-bz^3-cz^4-dz^5
% A = [0 1 1 1 1 1 1 1 1 1;
%     0 3 4 5 0 1 2 3 4 5;
%     0 6 12 20 0 0 2 6 12 20;
%     0 6 24 60 0 0 0 6 24 60
%     0 0 24 120 0 0 0 0 24 120;
%     1 0 0 0 -1 -2 -4 -8 -16 -32;
%     5 0 0 0 0 1 4 12 32 80;
%     20 0 0 0 0 0 -2 -12 -48 -160;
%     60 0 0 0 0 0 0 6 48 240;
%     120 0 0 0 0 0 0 0 -24 -240];
%  
%  b = [1; 0; 0; 0; 0; 0; 0; 0; 0; 0];
%  format rat
%  x = A\b;
%  resp = A*x; 
% correpontente
% B-pline:
% elseif tipok == 15 %pulso B-spline de grau 5
%     z = abs(z);
%     if z <= 1
%         v = 1 - (5/3)*z^3 + (55/36)*z^4 + ...
%             (85/216)*z^5;
%     elseif (z > 1) && (z < 2)
%         v = 1/2 + (5/2)*z - ...
%             5*z^2 + (10/3)*z^3 - ...
%             (35/36)*z^4 + (23/216)*z^5;
%     elseif (z >= 2) && (z <= 3)
%         v = (1/54)*(3-z)^5;
%     else
%         v = 0;
%     end
% 
%  
%  desenho nao suave
%  A = [0 1 1 1 1 1 1 1 1 1;
%     0 2 12 20 0 1 2 3 4 5;
%     0 2 12 20 0 0 2 6 12 20;
%     0 0 24 60 0 0 0 6 24 60
%     0 0 24 120 0 0 0 0 24 120;
%     1 0 0 0 -1 -2 -4 -8 -16 -32;
%     5 0 0 0 0 1 4 12 32 80;
%     20 0 0 0 0 0 -2 -12 -48 -160;
%     60 0 0 0 0 0 0 6 48 240;
%     120 0 0 0 0 0 0 0 -24 -240];
% 
% b = [1; 0; 0; 0; 0; 0; 0; 0; 0; 0];
%  format long
%  x = A\b;
%  resp = A*x;

 
% sistema do que deu muito pontudo
% A = [0 1 1 1 1 1 1 1 1 1;
%     0 1 4 5 0 1 2 3 4 5;
%     0 0 12 20 0 0 2 6 12 20;
%     0 0 24 60 0 0 0 6 24 60
%     0 0 24 120 0 0 0 0 24 120;
%     1 0 0 0 -1 -2 -4 -8 -16 -32;
%     5 0 0 0 0 1 4 12 32 80;
%     20 0 0 0 0 0 -2 -12 -48 -160;
%     60 0 0 0 0 0 0 6 48 240;
%     120 0 0 0 0 0 0 0 -24 -240];
%  
%  b = [1; 0; 0; 0; 0; 0; 0; 0; 0; 0];
%  format long
%  x = A\b;
%  resp = A*x; 
% 
% elseif tipok == 15 %pulso B-spline de grau 5
%     z = abs(z);
%     if z <= 1
%         v = 1 - (5/6)*z^3 + (5/36)*z^4 + ...
%             (11/216)*z^5;
%     elseif (z > 1) && (z < 2)
%         v = 11/12 - (5/12)*z - (5/6)*z^2 + (5/6)*z^3 - ...
%             (5/18)*z^4 + (7/216)*z^5;
%     elseif (z >= 2) && (z <= 3)
%         v = (1/108)*(3-z)^5;
%     else
%         v = 0;
%     end