- #1
madi281
- 1
- 0
i got this code of the internet, the reason i am unable to run is beacuse of this "pric" file, its like a "binprice" in matlab, but i think it is self made. this code is for a binomial model to solve TIAN pricing model
%File: TIAN1.m
% Objective: Binomial pricing of "in-the-money" american put
%option using TIAN binomial model
% Author: Group 4
S0=40;
K=45;
T= 5/12;
r= 0.08;
sigma = 0.30;
price=1:250;
for n=25:250
deltat=T/n;
M=exp(r*deltat);
V=exp(sigma^2*deltat);
s=sqrt(V^2+2*V-3);
u=M*V*(V+1+s)/2;
d=M*V*(V+1-s)/2;
p=(M-d)/(u-d);
beta=1/M;
V=pric(S0,K,u,d,p,beta,n); the error comes from this line as shown below
price(n)=V(1,1);
end;
plot(25:250,price(25:250));
xlabel('Iterations');
ylabel('Option Value');
title('Binomial Pricing');
Error in ==> TIAN1 at 20
V=pric(S0,K,u,d,p,beta,n);
so if anyone knows this pric file or does know a way around it, will be much better.
%File: TIAN1.m
% Objective: Binomial pricing of "in-the-money" american put
%option using TIAN binomial model
% Author: Group 4
S0=40;
K=45;
T= 5/12;
r= 0.08;
sigma = 0.30;
price=1:250;
for n=25:250
deltat=T/n;
M=exp(r*deltat);
V=exp(sigma^2*deltat);
s=sqrt(V^2+2*V-3);
u=M*V*(V+1+s)/2;
d=M*V*(V+1-s)/2;
p=(M-d)/(u-d);
beta=1/M;
V=pric(S0,K,u,d,p,beta,n); the error comes from this line as shown below
price(n)=V(1,1);
end;
plot(25:250,price(25:250));
xlabel('Iterations');
ylabel('Option Value');
title('Binomial Pricing');
Error in ==> TIAN1 at 20
V=pric(S0,K,u,d,p,beta,n);
so if anyone knows this pric file or does know a way around it, will be much better.