function [baze,velikost]=ortogonalni_baze(a,b,stupen);
%
% Sestroji system ortogonalnich polynomu 
% do stupne stupen na intervalu <a,b>

g=zeros(stupen+1);
velikost=zeros(stupen+1,1);
for i=1:stupen+1
  g(stupen+2-i,i)=1;
end;
f(1,:)=g(1,:);
for i=2:stupen+1
  soucin=conv(f(i-1,:),f(i-1,:));
  velikost(i-1)=integruj_polynom(soucin,a,b);
  for j=1:i-1
    s1=conv(g(i,:),f(j,:));
    kappa(i,j)=-(integruj_polynom(s1,a,b))/velikost(j); 
  end;
  f(i,:)=g(i,:);
  for j=1:i-1 
    f(i,:)=f(i,:)+kappa(i,j)*f(j,:);
  end;
end;
soucin=conv(f(stupen+1,:),f(stupen+1,:));
velikost(stupen+1)=integruj_polynom(soucin,a,b);

baze=f;


