You are close to solving it. You need to express ‘q’ as an anonymous function of ‘w’, then evaluate that function over the interval (-10,10):
fun = @(t,w)exp(-1i.*w.*t);
q = @(w) integral(@(t)fun(t,w),-1,1, 'ArrayValued',true);
wv = linspace(-10, 10);
figure(1)
plot(wv, real(q(wv)), '-b', wv, imag(q(wv)), '-r')
grid
So yes, you can use integral to evaluate the Fourier transform of your function. (It never occurred to me to do this, so I learned something.)
Best Answer