
via Instagram http://instagr.am/p/ToJQBcIyup/





properties: (things that define the option)
spot price, strike price, upper barrier, interest rate, dividend rate, volatility, expiration date.
methods:
price the option by Closed-form formula
price the option by simple Monte Carlo simulation
price the option with Monte Carlo simulation * antithetic variance reduction
price the option with MC simulation * control variates
properties (SetAccess = public)
<anything you would like to add>
yes, anything you would like to be included in the *class*. it can be double, integer, vector or anything. Keep in mind that you just need to put a name there first and don’t specify the form.
end
methodsend
function obj = <objectName>(external parameters)
the first function usually shares the same name with the object, and it’s exactly the constructor function. So at least one external parameter is need.
function A(obj)
end
function B(obj, external parameter)
end
function disp(obj)
and yes, you can overload some frequently-used functions specifically for your object
end
end
propertiesend
matrix5_5
double1
end
methods
function obj = example(void)
obj.matrix5_5 = zeros(5,5);
obj.double1 = 0; % see how we cite the value inside?
end
function randomAndPick(obj)
obj.matrix5_5 = randn(5,5)
obj.double1 = max(max(randn)
end
end
test1 = example();
test1.randomAndPick