view m-toolbox/test/test_ao_cdfplot.m @ 52:daf4eab1a51e
database-connection-manager tip
Fix. Default password should be [] not an empty string
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Wed, 07 Dec 2011 17:29:47 +0100 (2011-12-07) |
parents |
f0afece42f48 |
children |
|
line source
%
% 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)