% % Example epage: 36 % Problem epage: 41 % % Written by: % -- % John L. Weatherwax 2008-02-20 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clear all; close all; drawnow; clc; addpath('../../Code/eda_toolbox'); addpath('../../Code/eda_data'); n = 100; p = 2; X = randn(n,p); orig_dists = pdist(X); figure; odh=plot( sort(orig_dists), 'o' ); hold on; Xn1 = range_trans(X); % <- this implements equation 1.3 x1_dists = pdist(Xn1); dt1h=plot( sort(x1_dists), 'rx' ); Xn2 = range_trans(X,1); % <- this implements equation 1.4 x2_dists = pdist(Xn2); dt2h=plot( sort(x2_dists), 'kd' ); xlabel( '(i,j) index' ); ylabel( 'distance' ); title( 'the original distance and the normalized distance' ); legend( [odh,dt1h,dt2h], {'original data','Eq 1.3','Eq 1.4'}, 'location', 'northwest' ); title( 'the original distance and the normalized distance' ); saveas( gcf, '../../WriteUp/Graphics/Chapter1/prob_1_9_distances', 'eps' );