function I do not really understand, could somebody give me a hint?

조회 수: 1 (최근 30일)
Hi,
I have received a function which consists of several furnctions, but I have some problems to see what is going on here. In input parameters are given in line two: x0 = [1.1768 0.082259 0.83746 -0.54589]; %parameters: psi m xi rho
That's clear so mean that I can change them in order to get the function running. But I am not sure what is happending with those parameters. In the last function, the following is happening

채택된 답변

Wayne King
Wayne King 2013년 5월 19일
u is just the variable for integration, so I could define a function
function y = myfun(x)
y = x.^2;
end
and then integrate that function like:
quadl(@(u) myfun(u),0,2)
That is just the integral of x^2 from 0 to 2. So in LaTex
\int_{0}^{2} x^2 dx or \int_{0}^{2} u^2 du or whatever you variable you like.
Thank you for accepting my answer if I have helped you.

추가 답변 (1개)

Wayne King
Wayne King 2013년 5월 19일
This input
x0 = [1.1768 0.082259 0.83746 -0.54589];
is fed into CallPriceF() as the input argument, parameters.
Then, it is fed into the function, CallPriceIntegralF(), as the input argument, x.
So the code:
kappa = x(1); theta = x(2);
sigma = x(3); rho = x(4);
inside of CallPriceIntegralF() is really
kappa = x0(1); theta = x0(2);
sigma = x0(3); rho = x0(4);
  댓글 수: 1
Locks
Locks 2013년 5월 19일
thanks, do you know where the u in the last function comes from?
%Help vectors
o = sqrt(-1)*u; b = sigma*rho*o-kappa;
a = o.*(1-o); g = sqrt(b.^2+a*sigma^2); %gamma
B = - (a.*(1-exp(-g*T))) ./ (2*g - (g+b).*(1-exp(-g*T)));
A = -kappa*theta*( (g+b)/sigma^2 * T + 2/sigma^2 * log(1- (g+b)./(2*g).*(1-exp(-g*T))));
CHF = exp(A + B*V0 + o * log(F));

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by