%vstupne parametre
% Haarov wavelet 
%    a=0; b=0
% Db2 wavelet
    a=3.1415926/3; b=0
% Set number of iterations and wavelet name. 
%axis on
iter = 5;
wav = 'db2';
%wav = 'morl';
[phi,psi,xval] = wavefun(wav,iter);
hold on
%funkcia=(xval.*xval-5*xval);
funkcia=(3*xval);
sucin=funkcia.*psi;
plot( xval,psi,'red');
hold on
plot(xval,funkcia,'green');
plot(xval,sucin,':blue');

%priebeh sumacie
size=length(xval);
mysum=zeros(1,size);
for x=2:size
   mysum(x)=mysum(x-1)+sucin(x);
end
plot(xval,mysum/100,'black');

%vysledok je skalarneho sucinu je toto
vysledna_suma=sum(sucin(:))