% % An extension of example 9.2 % This illustrates the 1-D histogram using relative frequency and frequency. % % Written by: % -- % John L. Weatherwax 2005-08-14 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- close all; drawnow; rehash; clc; tit = {}; fn = {}; % Generate some standard normal data. X(:,1) = randn(400,1); tit{1} = 'standard normal data'; fn{1} = 'standard_normal'; % Generate some uniform data. tmp = 2.4*rand(398,1) - 1.2; % Add some outliers (two) to this data. X(:,2) = [tmp; [-2.9 2.9]']; tit{2} = 'uniform data with two outliers'; fn{2} = 'uniform'; % Generate data from three different normals: tmp1 = randn(300,1)*.5; tmp2 = randn(50,1)*.4-2; tmp3 = randn(50,1)*.4+2; X(:,3) = [tmp1; tmp2; tmp3]; tit{3} = 'a mixture of three gaussians'; fn{3} = 'mixture'; if( 0 ) % plot various box plots using this set of toy data % This is from the Statistics Toolbox: figure,boxplot(X,0,[],1,10); title('boxplot'); % We can get the histplot. This function is % included with this text. boxp(X,'hp'); title('histplot'); % Let's see what these look like using the box-percentile plot. boxprct(X) title( 'box percentile plot' ); else for ii=1:3, figure; histfit(X(:,ii)); title( tit{ii} ); axis( [ -3, +3, 0, 90 ] ); saveas( gcf, ['../../WriteUp/Graphics/Chapter9/prob_9_6_',fn{ii}], 'epsc' ); end end