Using int for fun.

2 ビュー (過去 30 日間)
doyoun Kim
doyoun Kim 2018 年 5 月 20 日
コメント済み: Star Strider 2018 年 5 月 21 日
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?

採用された回答

Star Strider
Star Strider 2018 年 5 月 20 日
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 件のコメント
doyoun Kim
doyoun Kim 2018 年 5 月 21 日
編集済み: doyoun Kim 2018 年 5 月 21 日
Thx a lot
Star Strider
Star Strider 2018 年 5 月 21 日
As always, my pleasure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by