How to solve a equation iteratively?

I am currently replicating the Synthetic Put Strategy in MATLAB according to Dichtl and Drobetz (2010) "Portfolio Insurance and Prospect Theory Investors", page 3. They say that
w_risky = (S*N(d1))/(S*N(d1)+K*exp(-r*T)*N(-d2)
where
S = Share Price
K = Strike Price
r = risk free rate
T = Time to Maturity
N(.) = standard normal cumulative distribution function
d1 = (ln(S/K)+(r+0,5*sig^2)*T)/(sig*sqrt(T))
d2 = d1-sig*sqrt(T)
So far everything is fine. and also works pretty good.
However, they say that the Stike Price K must be set such that the following holds:
K = F/W0*(S+P(K))
where
(F/W0) is the percentage floor and P(K) is the price of a put with K. This should be solved interatively and I dont know which command I could use or how to even start solving such a problem? Couldnt find anything that helped so far.
Many thanks in advance

2 件のコメント

dpb
dpb 2020 年 11 月 23 日
Try
fsolve(@(x) K-F/W0*(S+P(K)),x0)
You've still got undefined terms you'll have to have defined, though...particularly P(K) if it is a function.
Andi
Andi 2020 年 11 月 24 日
thank you

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

 採用された回答

Alan Stevens
Alan Stevens 2020 年 11 月 23 日

1 投票

Look at the fzero function.
Assuming you know P as a function of K, then with an initial guess for K
K0 = ...' % initial guess
K = fzero(fn,K0);
and
function Z = fn(K)
P = ...; % Calculated using K
Z = F/W0*(S + P) - K;
end
fzero will adjust K until it gets Z as close to zero as possible.

1 件のコメント

Andi
Andi 2020 年 11 月 24 日
thank you very much, that works perfectly
The only thing I had to change was adding a "@" sign
"K = fzero(@fn,K0);"

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOptimization Toolbox についてさらに検索

質問済み:

2020 年 11 月 23 日

コメント済み:

2020 年 11 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by