楼主: dandemoon
3077 0

[有偿编程] matlab 计算欧式期权 画图 [推广有奖]

  • 0关注
  • 0粉丝

本科生

9%

还不是VIP/贵宾

-

威望
0
论坛币
52 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
105 点
帖子
6
精华
0
在线时间
148 小时
注册时间
2012-12-27
最后登录
2024-6-21

楼主
dandemoon 发表于 2014-8-29 19:34:57 |AI写论文
30论坛币
% MATH1251: File = stock.m
% Simulate simple stock price process
% and estimate the expected value
clear
format
compact

% Model parameters
% r = risk-free interest rate
r = 0.00539;
% volatility
sigma = 0.3081;

% Current stock price
S0 = 57437;

% Time horizon (years)
T = 0.83;

% Print model parameters
fprintf('Initial stock price S0 = %.2f\n', S0);
fprintf(
'Risk-free rate = %.2f%%, volatility = %.2f%%\n', 100*r, 100*sigma);
fprintf(
'Time horizon = %.2f years\n', T);


% Time step in years for daily increments
Dt = 1/252;
% All the time points
t = [0:Dt:T];
m = length(t)-1;
fprintf(
'Number of time steps = %d, time step = %.4f years\n', m, Dt);


% N = number of simulations
N = 8000;
k=55000;


%Model S(t + Dt)=S*exp((r-0.5*sigma^2)*T + sigma*sqrt(T)*Z);
% where wt is a standard normal random variable
Z = randn(m, N);
z = exp((r-0.5*sigma^2)*Dt + sigma*sqrt(Dt)*Z);
S = S0*[ones(1,N); cumprod(z)];

price = sum(S(end,:))/N;
fprintf(
'For %3d simulations, realassetprice = %.2f\n', N, price);


figure(1)
plot(t, S);
grid on

xlabel('t (years)')
ylabel('real asset price S(t)')
title('real asset price')

有人知道怎么接着这段代码,算出欧式期权价值,并且画出欧式期权价格变动的图形吗? 拜托了

关键词:MATLAB matla atlab 欧式期权 Lab matlab 欧式期权

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-2-10 15:41