Matlab Code – Study Guide – tange
Search
Essays
Sign up
Sign in
Contact us
Tweet
Index
/Business
Matlab Code
Set up a Matlab Code to value European call or put options with 10 periods. (You will need 11 columns, since today is time 0, and your model should end at time 10.) Allow each “period” to be one-tenth of a user-input time to maturity for the option.To test your model, confirm the following values for call and put options with the given parameters.Please attach your Matlab code in the homework as well.Here are two solutions.Solution 1>> % M-file, bioption.m S0 = input(Stock Price At Time Zero=); X = input(Exercise Price=); r = input(Risk Free Rate=); Std = input(Volatility=); T= input(Total length of time=); Periods= input(Number of time steps to calculate=); dt=T/Periods;u=(1+Std*sqrt(dt))/(1-dt);d=1/u;p=(1+r-d)./(u-d);NodeNum=Periods+1;PriceTree=NaN(NodeNum,NodeNum);PriceTree(1,1)=S0;for idx=2:NodeNumPriceTree(idx,idx)=PriceTree(idx-1,idx-1)*d;PriceTree(1:idx-1,idx)=PriceTree(1:(idx-1),idx-1)*u;endCallValueTree= NaN(NodeNum,NodeNum);PutValueTree= NaN(NodeNum,NodeNum); CallValueTree(:,:) = max(PriceTree(:,:)-X,0);
PutValueTree(:,:) = max(X-PriceTree(:,:),0);DiscCallValueTree= NaN(NodeNum,NodeNum);DiscPutValueTree= NaN(NodeNum,NodeNum);for idx=Periods:-1:1; DiscCallValueTree(1:idx,idx)= ((1+r)^(-dt*idx))* (p*CallValueTree(1:idx,idx+1)+ (1-p)*CallValueTree(2:idx+1,idx+1)); endfor idx=Periods:-1:1; DiscPutValueTree(1:idx,idx)=((1+r)^(-(dt*idx)))* (p*PutValueTree(1:idx,idx+1)+ (1-p)*PutValueTree(2:idx+1,idx+1)); endCallOptionPrice=CallValueTree(1,1);PutOptionPrice=PutValueTree(1,1);Solution2S0=50;K=50;r=0.1;T=5/12;sigma=0.4;N=2;deltaT = T/N;u=exp(sigma * sqrt(deltaT));d=1/u;p=(exp(r*deltaT) – d)/(u-d);lattice = zeros(N+1,N+1);for i=0:N lattice(i+1,N+1)=max(0 , S0*(u^i)*(d^(N-i)) – K);endfor j=N-1:-1:0 for i=0:j lattice(i+1,j+1) = exp(-r*deltaT) * (p * lattice(i+2,j+2) + (1-p) * lattice(i+1,j+2)); end endprice = lattice(1,1);If it is the American callS0=100;K=100;r=0.06;T=1;sigma=0.25;N=10;deltaT = T/N;u=exp(sigma * sqrt(deltaT));
Continue for 1 more page »
Read full document
Download as (for upgraded members)
Citation Generator
MLA 7
CHICAGO
(2016, 02). Matlab Code. EssaysForStudent.com. Retrieved 02, 2016, from
“Matlab Code” EssaysForStudent.com. 02 2016. 2016. 02 2016 <
"Matlab Code." EssaysForStudent.com. EssaysForStudent.com, 02 2016. Web. 02 2016. <
"Matlab Code." EssaysForStudent.com. 02, 2016. Accessed 02, 2016.
Essay Preview
By: tange
Submitted: February 14, 2016
Essay Length: 350 Words / 2 Pages
Paper type: Study Guide Views: 375
Report this essay
Tweet
Related Essays
Arizona Accountancy Code of Ethics
Arizona Accountancy Code of Ethics University of Phoenix Contemporary Business Law I BUS/421 October 19, 2008 As in any profession, ethics are extremely important, however
1,236 Words | 5 Pages
A True Code Hero
Hemingway a bright and simple man. A man who writes stories with characters who control their emotions or don't complain about what's going on in
1,267 Words | 6 Pages
Hammurabis Code
Hammurabi's Code The formers of the Hammurabi's Code of Laws surely created strict rules with severe punishments for their violation. In fact, these laws played
338 Words | 2 Pages
Dress Codes
It is in the middle of summer and very hot and humid. You are in complete uniform, wearing the long wool pants with the shirt,
444 Words | 2 Pages
Similar Topics
Design Speaker Recognition System Matlab
Personal Code Ethics
Get Access to 89,000+ Essays and Term Papers
Join 209,000+ Other Students
High Quality Essays and Documents
Sign up
© 2008–2020 EssaysForStudent.comFree Essays, Book Reports, Term Papers and Research Papers
Essays
Sign up
Sign in
Contact us
Site Map
Privacy Policy
Terms of Service
Facebook
Twitter