Option
Explicit
Public
Sub
kurs()
Dim
aktienkurs()
As
Double
Dim
sigma
As
Double
, zins
As
Double
, random
As
Double
Dim
N
As
Integer
, anzahlPfade
As
Integer
Dim
t
As
Integer
, j
As
Integer
N = Sheets(1).Range(
"A1"
).Value
ReDim
aktienkurs(N + 1)
aktienkurs(0) = 1
sigma = 1
zins = 0.0005
anzahlPfade = 5
Sheets(2).Cells(1, 1).Value =
"Zeit"
For
t = 0
To
N
Sheets(2).Cells(t + 2, 1).Value = t
Next
For
j = 1
To
anzahlPfade
Sheets(2).Cells(1, j + 1).Value =
"Aktienkurs - Pfad "
& j
Sheets(2).Cells(2, j + 1).Value = aktienkurs(0)
For
t = 0
To
N - 1
aktienkurs(t + 1) = aktienkurs(t) * Exp(zins + 0.5 * sigma ^ 2) + Application.WorksheetFunction.Norm_Inv(Rnd, 0, 1)
Sheets(2).Cells(t + 3, j + 1).Value = aktienkurs(t + 1)
Next
Next
End
Sub