the question is attached I have to answer, but I'm having problems.
I tried writing like this
fun = @(t,w)exp((-1i).*w.*t);
q=integral(@(t)fun(t,w),-1,1);
int() is recommended, but can it be written like above?

 Respuesta aceptada

Star Strider
Star Strider el 20 de Mayo de 2018

1 voto

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.)

2 comentarios

doyoun Kim
doyoun Kim el 21 de Mayo de 2018
Editada: doyoun Kim el 21 de Mayo de 2018
Thx a lot
Star Strider
Star Strider el 21 de Mayo de 2018
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Preguntada:

el 20 de Mayo de 2018

Comentada:

el 21 de Mayo de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by