-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExamplePlot.m
60 lines (49 loc) · 1.31 KB
/
ExamplePlot.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
% run first
clear
clc
addpath(genpath('functions'))
% Override default parameters
r = 0.03;
sigma = 0.28;
% Run after setting parameters
run loadParams
% Plot C and P as functions of r, X, s0
for i = 1:3
switch i
case 1
var = r;
which = 2;
titl1 = 'Risk-free rate effect on call value';
titl2 = 'Risk-free rate effect on put value';
xlabl = 'Risk-free rate';
case 2
var = X;
which = 3;
titl1 = 'Strike price effect on call value';
titl2 = 'Strike price effect on put value ';
xlabl = 'Strike price';
case 3
var = s0;
which = 4;
titl1 = 'Spot price effect on call value';
titl2 = 'Spot price effect on put value';
xlabl = 'Spot price';
end
interval = [0.5*var 1.5*var];
samples = round((n+1)^2);
spacing = (interval(2)-interval(1))/samples;
paramvals = interval(1):spacing:interval(2);
[VAR, C, P] = optionDependence(o_prm,which,paramvals);
subplot(3,2,2*i-1)
plot(VAR,C)
grid on
title(titl1)
xlabel(xlabl)
ylabel('Call Value')
subplot(3,2,2*i)
plot(VAR,P)
grid on
title(titl2)
xlabel(xlabl)
ylabel('Put Value')
end