% correlation coefficients:
n = 10000;
x = randn( n, 1 );
f = figure( 1 );
for r = 0.01:0.19:1
    fprintf( 'Correlation = %g\n', r );
    clf( f );
    y = r*x + sqrt(1-r^2)*randn( n, 1 );
    covareigen( x, y, 0, 5.0, 3.0 );
    %key = waitforbuttonpress;
    pause( 1.0 );
end

% two distributions:
n = 10000;
x1 = randn( n/2, 1 );
y1 = randn( n/2, 1 );
x2 = randn( n/2, 1 );
y2 = randn( n/2, 1 );
f = figure( 1 );
for d = 0:1:5
    fprintf( 'Distance = %g\n', d );
    clf( f  );
    d2 = d / sqrt( 2.0 );
    x = [ x1; x2 ];
    y = [ y1+d2; y2-d2 ];
    covareigen( x, y, 0, 10.0, 7.0 );
    %key = waitforbuttonpress;
    pause( 1.0 );
end