trapz
expects a vector of function evaluations, not a function handle, which is what integral
expects.
if Sequence ( 1, counter1) == 1
s_of_t = @(t,F) A*cos(w*t).*exp(-1i*2*pi*t*F);
else
s_of_t = @(t,F) -A*cos(w*t).*exp(-1i*2*pi*t*F);
end
for i=1:length(F)
r=linspace(((counter1-1)*Tb),(counter1*Tb),100);
S_of_f(i) = trapz(r,s_of_t(r,F(i)));
end
...
I arbitrarily chose 100 evaluation points for the integral using trapz
; you will want to modify this to an appropriate value depending on how you are using this code.