function I = filon_sin(w,f,t,N)

wmin = w(1);
wmax = w(end);

N = N/2;

dw = (w(end)-w(1))/(2*N);
ww = wmin:dw:wmax;
ff = spline(w,f,ww);

%figure
%plot(w,f,'x',ww,ff,'-x');

I = zeros(length(t),1);
for i = 1:length(t)

S2n_1 = 0; C2n_1p = 0;
S2n = 0.5*ff(1)*sin(t(i)*ww(1))-0.5*ff(2*N+1)*sin(t(i)*ww(2*N+1)); 
for j = 1:N
  S2n_1 = S2n_1+ff(2*j)*sin(t(i)*ww(2*j));
  C2n_1p = C2n_1p+ff(2*j)*cos(t(i)*ww(2*j));  
  S2n = S2n+ff(2*j+1)*sin(t(i)*ww(2*j+1));
end
     
theta = t(i)*dw;
[alpha,beta,gamma] = filon_coeffs(theta);


I(i) = alpha*(ff(1)*cos(t(i)*ww(1))-ff(2*N+1)*cos(t(i)*ww(2*N+1))) + beta*S2n + gamma*S2n_1 + 2*t(i)*dw^4*C2n_1p/45;
end

I = I*dw;




