diff m-toolbox/test/test_ao_cdfplot.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/test_ao_cdfplot.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,61 @@
+% 
+% A test script for cdfplot
+% 
+% L Ferraioli 30-06-2011
+%
+% $Id: test_ao_cdfplot.m,v 1.1 2011/07/08 09:25:54 luigi Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% useful vars
+nsecs = 1000;
+fs = 1;
+
+%% build test objects
+
+a1 = ao.randn(nsecs,fs);
+a2 = ao.randn(nsecs,fs);
+a3 = ao.randn(nsecs,fs);
+a4 = ao.randn(nsecs,fs);
+
+
+%% test empirical
+
+cdfplot(a1,a2,a3)
+
+%% test Gaussian
+
+plcdf = plist('TESTDISTRIBUTION','NORMAL');
+cdfplot(a1,a2,a3,plcdf)
+
+%% test Chi2
+
+% chi2 with 2 degrees of freedom
+y1 = a1.^2 + a2.^2;
+y2 = a3.^2 + a4.^2;
+
+plcdf = plist('TESTDISTRIBUTION','CHI2','DOF',2);
+cdfplot(y1,y2,plcdf)
+
+%% test F
+
+% chi2 with 2 degrees of freedom
+y1 = a1.^2 + a2.^2;
+y2 = a3.^2 + a4.^2;
+% f distribution with 2 and 2 degrees of freedom
+y3 = y1./y2;
+
+plcdf = plist('TESTDISTRIBUTION','F','DOF1',2,'DOF2',2);
+cdfplot(y3,plcdf)
+
+%% test Gamma
+
+% this requires statistics toolbox
+k = 10; % shape parameter
+theta = 2; % scale parameter
+Y1 = random('Gamma',k,theta,1000,1);
+b1 = ao(plist('fs', 1, 'yvals', Y1, 'type', 'tsdata'));
+Y2 = random('Gamma',k,theta,1000,1);
+b2 = ao(plist('fs', 1, 'yvals', Y2, 'type', 'tsdata'));
+
+plcdf = plist('TESTDISTRIBUTION','GAMMA','SHAPE',k,'SCALE',theta);
+cdfplot(b1,b2,plcdf)