function [a0,A,B] = fourier(f,n)
%f je 2pi periodicna funkcija

A=zeros(1,n);
B=zeros(1,n);

a0 = 1/(2*pi)*integral(f,-pi,pi);

for i=1:n
    A(i) = 1/pi*integral(@(x)f(x).*cos(i.*x) ,-pi,pi);
    B(i) = 1/pi*integral(@(x)f(x).*sin(i.*x),-pi,pi);
end
