[問題] 解聯立方程組 (nonlinear)已回收
小弟想要解一個聯立方程組
其中還包含有 normal distribution 的 cdf
如下
solve:
eq1: E = V * N(d1) + exp(-rT) * D * N(d2)
eq2: sigmaE * E = N(d1) * sigmaV * V
其中 E, sigmaE, D, r, T 已知,
且 N() 為 standard normal distribution 的 cdf 函數
我該如何利用 matlab 寫一個程式讓它解出 V 和 sigmaV 呢?
以下是我的 code :
clear all ;
mu = 0 ;
sigma = 1 ;
D = 1000 ;
E = 400 ;
sigma_e = 0.65 ;
T = 1 ;
r = 0.05 ;
%d1 = (log(V/D) + (r+ sigma_v^2/2)*T ) / (sigma_v *sqrt(T)) ;
%d2 = d1 - sigma_v * sqrt(T) ;
eq1 = 'E = V * normcdf(d1,mu,sigma) + exp(-rT) * D * normcdf(d2,mu,sigma)' ;
eq2 = 'sigma_e * E = normcdf(d1,mu,sigma) * sigma_v * V' ;
sol = fsolve (eq1,eq2,'V','sigma_v')
但怎麼樣都解不出來
系統一直告訴我有問題...
它一直告訴我這樣:
??? Error using ==> fsolve at 133
FSOLVE only accepts inputs of data type double.
Error in ==> eq at 18
sol = fsolve (eq1,eq2,'V','sigma_v')
請問我該怎麼修改呢?
麻煩各位先進為小弟解答
感激不盡..
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.138.88
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章