updated TestCREClass

This commit is contained in:
Renken 2020-02-25 17:30:53 +01:00
parent 8ac21ada83
commit 6c31374b1a
1 changed files with 25 additions and 12 deletions

View File

@ -1,25 +1,38 @@
%% 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;
S.Data=randn(100,1);
S.nBin=(1000);
%% use histogram
%% 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
% 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
std(S.Data)
%% multiply S
S.Data=100*S.Data;
%% Show effect of scaling or ofsett the data
% Scale
S.Data=100*A;
S.UseHistProxy=true;
S.Calc;
S
std(S.Data)
%% ones again the "new" way
S.UseHistProxy=false;
% Offset
S.Data=A+10;
S.UseHistProxy=true;
S.Calc;
S
%%
%% Test CCRE class
figure(1);clf;hold on
figure(2);clf;
@ -41,6 +54,6 @@ for k=-1:0.1:1
scatter(CS.DataRef(:),CS.Data(:));
figure(3);
plot(k,CS.CCRE./CS.CRE,'d');
pause(0.01)
end
CS
CS
snapnow