Numerically solving for the lower bound of integral
2 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
採用された回答
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)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!