% % Written by: % -- % John L. Weatherwax 2006-12-31 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clc; close all; E1 = 2.5; E2 = 5.6; S = linspace(1.0,10)'; V = zeros(1,length(S)); indLT = find( S < E1 ); V(indLT) = -(E1-S(indLT)); indGT = find( S > E2 ); V(indGT) = S(indGT)-E2; figure; plot( S, V, 'o' ); grid on; xlabel('stock price at expiry'); ylabel('the value of a range forward contract'); title( 'the payoff for a range forward contract' ); saveas( gcf, '../../WriteUp/Graphics/Chapter6/prob_6_12', 'epsc' );