フィルターのクリア

Integration of two functions, one of them is piecewise function

1 回表示 (過去 30 日間)
Hanson Zhou
Hanson Zhou 2015 年 9 月 29 日
コメント済み: Hanson Zhou 2015 年 10 月 12 日
Consider the function
p(µ, σ, t, x) = exp(-m*t)/x*sqrt(2*pi*(q.^2)*t)*exp(-1/(2*(q.^2)*t)*(log(x)-(m-(q.^2)/2)*t).^2) (0 < x < )
Here let µ = .02, σ = .18 and t = .25, so p is a function on the variable x only. I created a function file pfun.m for this function, having µ, σ, t and x as input.
I need to compute int(C(x)*p(x),x,0,inf)
where C(x) = 0 if x < 1.02
x − 1.02 otherwise

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 9 月 29 日
編集済み: Walter Roberson 2015 年 9 月 29 日
general_p = @(m, q, t, x) exp(-m.*t) ./ x .*sqrt(2*pi*(q.^2).*t) .* exp(-1/(2*(q.^2).*t) .* (log(x)-(m-(q.^2)/2) .*t ).^2);
p = @(x) general_p(0.02, 0.18, 0.25, x);
C = @(x) (x - 1.02) .* (1.02 <= x);
result = integral(@(x) C(x) .* p(x), 0, inf)
  3 件のコメント
Walter Roberson
Walter Roberson 2015 年 9 月 29 日
I have adjusted the code, above.
Hanson Zhou
Hanson Zhou 2015 年 10 月 12 日
Thank you so much. Sry about the late replay

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by