Info

This question is closed. Reopen it to edit or answer.

A Matlab loop problem. Getting 1 solution instead of 54. Anyone knows why?

1 view (last 30 days)
hi there,
I programmed a little script that uses a function to calculate a call price in the heston model. Now I built in a for loop that should calculate the Call price for each day in my excel sheet. There are 54 days, so I consider to get 54 solutions. But I only receive 1 solution. Anyone knows why?
Here is my code:
daten=xlsread('CallPreise.xlsx','Jan','B2:K55'); %Januar
phi = 1;
S=daten(:,1);
K=daten(:,2);
T=daten(:,3);
rd=daten(:,4);
rf=daten(:,5);
kappa=daten(:,6);
theta=daten(:,7);
sigma=daten(:,8);
rho=daten(:,9);
v0=daten(:,10);
alpha=0.75;
method=1;
s0 = log(S);
k = log(K);
ende = length(S);
Call = zeros(ende,1);
for count = 1:ende
Call = HestonFFTVanilla(phi,S(count),K(count),T(count),rd(count),rf(count),kappa(count),...
theta(count),sigma(count),rho(count),v0(count),alpha,method);
end
Regards boulala

Answers (1)

Torsten
Torsten on 31 Mar 2015
Call(count)=HestonFFTVanilla(phi,S(count),K(count),T(count),rd(count),rf(count),kappa(count),...
theta(count),sigma(count),rho(count),v0(count),alpha,method);
Best wishes
Torsten.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!