odd handling of tensors by blsprice
Mostra commenti meno recenti
Hi
I am trying to investigate the shape of the scalar field of the Black Scholes option pricing formula.
In matalb to vary all 5 of the parameters rather than inputing a vector for each parameter, you have to do it by inputting a tesseract.
In the folowing code each tesseract is 12*12*12*12*12
Tess = ones(12,12,12,12,12);
StockPTess = Tess.*[1:12];
StockPTess = permute(StockPTess,[2,1,3,4,5]);
StrikePTess= Tess.*[1:12];
RateTess = Tess.*[0.05:0.05:0.6];
RateTess = permute(RateTess,[1,3,2,4,5]);
TimeTess = Tess.*[1:12];
TimeTess = permute(TimeTess,[1,3,4,2,5]);
VolTess = Tess.*[0.2:0.2:2.4];
VolTess = permute(VolTess,[1,3,4,5,2]);
Price = blsprice(StockPTess,StrikePTess,RateTess,TimeTess,VolTess);````
Instead of outputing a 12*12*12*12*12 matrix, this exports a 12*20736 matrix, from the help page i can see no indication of which entries in the matrix correspond to which element of the tesseract that I expected to get out.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Financial Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!