楼主: 莫某某
1168 0

FULL TRUCATION MATLAB CODE [推广有奖]

  • 0关注
  • 0粉丝

高中生

15%

还不是VIP/贵宾

-

威望
0
论坛币
1849 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
299 点
帖子
10
精华
0
在线时间
20 小时
注册时间
2011-10-27
最后登录
2016-6-29

楼主
莫某某 发表于 2013-7-3 21:47:21 |AI写论文
10论坛币
求各位帮我看看这个MATLAB CODE 哪需要改?

运行这个CODE 给我的提示是
Error using  +
Matrix dimensions must agree.
Error in ft (line 25)
    V(:,i+1)=V(:,i) + k*(theta-V_plus)*h + xi*sqr_h*delte_Wv;


%Using the Full trucation scheme to price a European option in the Heston
%Model
K = 100;         % Fixed Price
T = 10;          % Time
S0 = 100;        % Initial asset price
V0 = 0.04;       % Initial volatility
k = 0.5;         % speed of mean-reversion of the variance
theta = 0,04;          %long-term average variance;
xi = 1;          % volatility of variance
po = -0.9;       % instantaneous correlation between asset price and variance
n = 10;        % number of simulation path
h = 1;           % number of stepes per year
sqr_h = sqrt(h);         
Z1 = randn(n,T);        % random number form normal distribution
Z2 = randn(n,T);
Zv = Z1;
delte_Wv = Zv * sqr_h     % Winner process of volatility
% Winner process of asset price
delte_Ws = po * delte_Wv + sqrt(1-po^2)* Z2 * sqr_h;   
% initialize variances and asset price
V = [V0*ones(n,1),zeros(n,T)]
logS = [log(S0)*ones(n,1),zeros(n,T)];
for i = 1 : n
    % fix the negative volatility to 0
    V_plus = max(V(:,i),0);   
    % calculate the volatility
    V(:,i+1)=V(:,i) + k*(theta-V_plus)*h + xi*sqr_h*delte_Wv;
    % calculate the log asset price
    logS(:,i+1)=logS(:,i)-0.5*V_plus*h + sqr_h.*delte_Ws;
end

我应该怎么改下谢谢?

关键词:matlab code cation MATLAB ATION atlab Matrix option price Error

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
扫码
拉您进交流群
GMT+8, 2026-2-16 14:05