function circular_normal_sample_test ( ) %*****************************************************************************80 % %% CIRCULAR_NORMAL_SAMPLE_TEST tests CIRCULAR_NORMAL_SAMPLE. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 03 January 2012 % % Author: % % John Burkardt % sample_num = 1000; seed = 123456789; a = [ 1.0, 5.0 ]; b = 0.75; fprintf ( 1, '\n' ); fprintf ( 1, 'CIRCULAR_NORMAL_SAMPLE_TEST\n' ); fprintf ( 1, ' CIRCULAR_NORMAL_MEAN computes the Circular Normal mean;\n' ); fprintf ( 1, ' CIRCULAR_NORMAL_SAMPLE samples the Circular Normal distribution;\n' ); fprintf ( 1, ' CIRCULAR_NORMAL_VARIANCE computes the Circular Normal variance.\n' ); mean = circular_normal_mean ( a, b ); variance = circular_normal_variance ( a, b ); fprintf ( 1, '\n' ); fprintf ( 1, ' PDF means = %14g %14g\n', mean(1:2) ); fprintf ( 1, ' PDF variances = %14g %14g\n', variance(1:2) ); for i = 1 : sample_num [ x, seed ] = circular_normal_sample ( a, b, seed ); x_table(i,1) = x(1); x_table(i,2) = x(2); end for j = 1 : 2 mean(j) = r8vec_mean ( sample_num, x_table(1:sample_num,j) ); variance(j) = r8vec_variance ( sample_num, x_table(1:sample_num,j) ); xmax(j) = max ( x_table(1:sample_num,j) ); xmin(j) = min ( x_table(1:sample_num,j) ); end fprintf ( 1, '\n' ); fprintf ( 1, ' Sample size = %6d\n', sample_num ); fprintf ( 1, ' Sample mean = %14g %14g\n', mean(1:2) ); fprintf ( 1, ' Sample variance = %14g %14g\n', variance(1:2) ); fprintf ( 1, ' Sample maximum = %14g %14g\n', xmax(1:2) ); fprintf ( 1, ' Sample minimum = %14g %14g\n', xmin(1:2) ); return end