% % % Written by: % -- % John L. Weatherwax 2009-04-21 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- close all; drawnow; rehash; clc; clear; addpath( '../../Code/eda_data' ); addpath( '../../Code/eda_toolbox' ); addpath( '../Chapter1' ); n = 20; z1 = randn(1,n); % <- the first group is centered around zero z2 = [-3+randn(1,0.5*n), +3+randn(1,0.5*n) ]; % <- the second group is centered around -2,+2 z2 = z2( randperm(n) ); % <- scramble the data % test that we are generating correlated random variables correctly the (1,2) element should equal rho above: CC = corrcoef( z1, z2 ); fprintf('sample correlation coefficient rho(z1,z2) = %10.6f\n', CC(1,2) ); figure; parallelcoords( [ z1(:), z2(:) ] ); title( 'parallel coordinate plot rho=+1.0' ); saveas( gcf, '../../WriteUp/Graphics/Chapter10/prob_10_12', 'epsc' );