%% Test CCRE and CRE class % show some default behaviour % and test the error handling. %% set some constants A=randn(100); %% create instance of CRE class S=CREClass; %% check histogram vs "new" technique % NB I come to the conclusion that the new method is not always working. % Why? S.Data=A;% set gaussian data S.nBin=(numel(S.Data)); % set nbin to npoints; This is fine as we use the cummulative distribution and the formulas as defined in Zografos % use histogram S.UseHistProxy=true; S.Calc; S % Use my aproximation for the histogram % only do this if the number of data points is not too big. S.UseHistProxy=false; S.Calc; S %% Show effect of scaling or ofsett the data % Scale S.Data=100*A; S.UseHistProxy=true; S.Calc; S % Offset S.Data=A+10; S.UseHistProxy=true; S.Calc; S %% %% Test CCRE class figure(1);clf;hold on figure(2);clf; figure(3);clf;hold on; A=randn(100); B=A; B(:)=A(randperm(numel(A))) for k=-1:0.1:1 CS=CCREClass; CS.Data=1*(1-abs(k))*A+k*B; CS.nBin=50; CS.DataRef=B; CS.nBinRef=500; CS.Calc; figure(1); plot(k,CS.CCRE,'o') plot(k,CS.CRE,'x'); figure(2); scatter(CS.DataRef(:),CS.Data(:)); figure(3); plot(k,CS.CCRE./CS.CRE,'d'); end CS snapnow