Find integral of a function where upper limit changes inside the function

5 ビュー (過去 30 日間)
Atr cheema
Atr cheema 2017 年 11 月 5 日
編集済み: Torsten 2017 年 11 月 7 日
I want to calculate integral of in equation 12 in image.
When t=30,D=250, x=40., I have found it with following code
t = 30
a=@(g) ((t-g).^(-1.5)).*exp(-4./(t-g));
b=integral(a,0,t);
h=282.09.*b
But I am unable to do it when t is a vector say t = 1:30, it means I want to find out h at every t from 1 to 30.

採用された回答

Birdman
Birdman 2017 年 11 月 6 日
編集済み: Birdman 2017 年 11 月 6 日
for t = 1:1:30
a=@(g) ((t-g).^(-1.5)).*exp(-4./(t-g));
b=integral(a,0,t);
h(t)=282.09.*b
end
  12 件のコメント
Atr cheema
Atr cheema 2017 年 11 月 7 日
編集済み: Atr cheema 2017 年 11 月 7 日
@Torsten may be I am getting nothing at all. How can I come from the graph from your code to the target graph which I mentioned before where I have input sine wave g(t) (black line) and output (yellow line)?
Torsten
Torsten 2017 年 11 月 7 日
編集済み: Torsten 2017 年 11 月 7 日
Change
x = 40;
t = 1:30;
g = @(tau) sin(tau);
to
x = 30;
t = linspace(0.05,100,2000);
g = @(tau) sin(tau/2);
in the above code.
Best wishes
Torsten.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by