Numerically solving for the lower bound of integral

2 ビュー (過去 30 日間)
Nicolai Raith
Nicolai Raith 2021 年 1 月 11 日
コメント済み: Nicolai Raith 2021 年 1 月 11 日
Hey everyone,
I'm very new with Matlab and struggling with finding the lower bound of an integral.
My idea was to use "vpasolve" and solve the integral nummerically for my lower bound given my function, upper bound and the result of the integral. However if I do so I get the error that "A and B must be floating-point scalars." and I do not have any clue how to tackle that issue.
I replaced in my original function F with x because I need to solve my integral over F (which is also my upper bound - here 79.335 but in my code a variable).
syms Lower_Bound x
Issue=Funct(V0,x,r,T,sigma_v);
fun=@(x)Issue/x;
[Lower_Bound]=vpasolve((integral(fun,Lower_Bound,79.335))==2);
The function "Issue" is given by:
function [Issue] = Funct(V,F,r,T,sigma_v)
d1=(log(V0/F)+(r+0.5*sigma_v^2)*T)/(sigma_v*sqrt(T));
d2=(log(V0/F)+(r-0.5*sigma_v^2)*T)/(sigma_v*sqrt(T))
Issue = normcdf(-d1)*V0+normcdf(d2)*F*exp((-r)*T);
I hope I stated my issue clear enough.
Many thanks in advance for your help.

採用された回答

Walter Roberson
Walter Roberson 2021 年 1 月 11 日
syms Lower_Bound x
Issue = Funct(V0,x,r,T,sigma_v);
fun = matlabFunction(Issue/x, 'vars', x);
LB_guess = 1.23;
LowerBound = fzero(@(LB) integral(fun, LB, 79.335) - 2, LB_guess)
  1 件のコメント
Nicolai Raith
Nicolai Raith 2021 年 1 月 11 日
This works. Thank you so much.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by