The following data was imported by left clicking the file on the folder pane to bring up the import window and imported as a cell array. Each column is going to be one of my variables (K = 1st column etc).
StrikePrice UnderlyingPrice mT Rf DividendRate Volatility
47 45 4 0.02 0.5 0.2
50 55 20 0.03 0.1 0.35
And I am using a function first written by Mark Hoyle (2016) that prices American Calls
function LSMAmCallContDiv(S0,K,D,r,sigma,T,NSteps,NSims)
To fill in the first row of my data for this function;
function LSMAmCallContDiv(45, 47, 0.5, 0.02, 0.2, 4, 500, 100)
Is there anyway I can do this function without manually having to change the values for the second row in my cell array? (I'm dealing with a lot of rows in reality). This was something I achieved when pricing puts in RStudio with the following code however I am a complete beginner to MatLab.
jpmitmput30results = apply(jpmitmput30full, 1, function(x) AmerPutLSM(Spot = x['UnderlyingPrice'], sigma = x['Volatility'],
n=500, m=100, Strike = x['StrikePrice'],
r = x['Rf'], dr = x['DividendRate'],
mT = x['mT']))
function LSMAmCallContDiv(S0,K,D,r,sigma,T,NSteps,NSims)has no output arguments. What does it do? Does it write to the console? Or to a file? You'd have to adapt the function to output a variable, to make it useful.