function TrigonometrickaAproximace()

syms x
f = sin(x)*exp(x);
n = 100;

fn = 0;

figure
xx = 0:0.01:2*pi;
plot(xx,eval(subs(f,xx)),'r');
for j=0:n
    alfajc = int(f*cos(j*x),x,0,2*pi)
    normajc = int(cos(j*x)*cos(j*x),x,0,2*pi)
    fn = fn + (alfajc/normajc)*cos(j*x);
    if j>0
        alfajs = int(f*sin(j*x),x,0,2*pi)
        normajs = int(sin(j*x)*sin(j*x),x,0,2*pi)
        fn = fn + (alfajs/normajs)*sin(j*x);
    end
    hold on;
    plot(xx,eval(subs(fn,xx)));
    pause
end

