在Matlab中用一个相当复杂的方程求解3个变量


syms omega j theta sigma
k=[90 94 98 102 106 110]; % Strike prices
putprices=[.1606 .2806 .9285 2.8801 6.1523 10.0147]; % Put prices at each strike
mustar = log(100)-sigma.^2/2-omega.*(exp(-theta)-1); % risk-neutral mean
Es1j=exp(mustar-theta.*j+sigma.^2./2); % Expected value of stock price at state j 1 period from now
x1=(log(k)-(mustar-theta.*j))./sigma; % the first normcdf value
x2=(log(k)-(mustar-theta.*j)-sigma.^2)./sigma; % the second normcdf value
qpkandj = k.*normcdf(x1)-Es1j.*normcdf(x2); % combination of normcdfs and strike prices and expected value of stock price 1 peroid from now
qpk=exp(-omega).*omega.^j./factorial(j).*qpkandj; % Poisson formula
eqns = symsum(qpk,j,0,inf)== putprices % Continuation of Poisson formula
assume(omega > 0)
assume(theta, 'real') 
assume(sigma, 'real')
S = solve(eqns, [omega theta sigma], 'Real', true, 'ReturnConditions', true)
S.omega
S.theta
S.sigma

试图在泊松混合模型上找到三个参数(ω、θ和西格玛(的值,这三个参数将泊松方程的输出与第三行中的putprice相匹配。每当我运行这个程序时,我都会得到一个非常长的条件列表,我试图将其全部放入假设条件中,但没有什么区别。有人知道发生了什么,或者我如何才能做到这一点吗?

Matlab将打印条件列表,因为您没有添加分号。为了避免打印条件列表,只需添加分号,如下所示:

eqns = symsum(qpk,j,0,inf) == putprices; % Continuation of Poisson formula

最新更新