i got this code over the interent, its for the TIAN binomial model
% File: TIAN1.m
% Objective: Binomial pricing of "at-the-money" american put
%option using TIAN binomial model
% Author: Group 4
S0=40;
K=40;
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);
price(n)=V(1,1);
end
plot(25:250,price(25:250));
xlabel('Iterations');
ylabel('Option Value');
title('Binomial Pricing');
its giving me error
Error in ==> TIAN2 at 20
V=pric(S0,K,u,d,p,beta,n);
the problem is with the "pric" function, because its not like "binprice" you can use in matlab, it is self made. i got in touch with the guy who posted this code and he doesnt even have it, as he posted it around 2006. Anywaz i was wondering if any one could help me on this. any suggestions or ideas wil be appriciated. Thank you