Code covered by the BSD License  

Highlights from
trinomial tree plot

trinomial tree plot

by

 

This function plots the Hull-White tree structure

trintree_plot( BKTree )
function [ output_args ] = trintree_plot( BKTree )

% This function plots the tree in its effective shape.

T=BKTree.tObs';
figure, 
for i=1:length(BKTree.Connect), 
    u1=BKTree.Connect{i}'; 
    switch BKTree.FinObj
        case 'HWFwdTree'
            u0=BKTree.FwdTree{i}';
            u2=BKTree.FwdTree{i+1}'; 
        case 'BKFwdTree'
            u0=BKTree.FwdTree{i}';
            u2=BKTree.FwdTree{i+1}'; 
        case 'HWRateTree'
            u0=BKTree.RateTree{i}';
            u2=BKTree.RateTree{i+1}';
        case 'BKRateTree'
            u0=BKTree.RateTree{i}';
            u2=BKTree.RateTree{i+1}';
    end
    t0=T(i);
    t1=T(i+1);
    for k=1:length(u0)
        
        line([t0;t1],[u0(k) u2(u1(k)-1)])
        line([t0;t1],[u0(k) u2(u1(k))])
        line([t0;t1],[u0(k) u2(u1(k)+1)])
        
    end
    
end
set(gca,'tickdir','out','xlim',[0 BKTree.CFlowT{1}(end)])%,'xtick',[0; BKTree.CFlowT{1}])
output_args=[];

end

Contact us