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