view m-toolbox/test/tsdata_class_test.m @ 22:b11e88004fca database-connection-manager

Update collection.fromRepository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% Test script for timeseries (tsdata) class.
% 
% 
% M Hewitson 31-01-07
% 
% $Id: tsdata_class_test.m,v 1.7 2009/02/02 15:20:38 hewitson Exp $
% 
function tsdata_class_test()

% Test constructor 1
ts = tsdata()

% Test constructor 2
ts = tsdata(randn(1000,1))

%% Test constructor 3

fs    = 1000;
nsecs = 10;
t     = linspace(0, nsecs-1/fs, nsecs*fs);
y     = randn(fs*nsecs,1);

ts = tsdata(t,y)

%% Test constructor 4

fs    = 1000;
nsecs = 2;
y     = randn(1,fs*nsecs);

ts = tsdata(y,fs);

ts.setT0(time('2007-01-31 12:33:33'));
ts.setXunits('s');
ts.setYunits('V');
ts

%% Test constructor 5

y  = randn(1000,1);
t0 = time(3000);

ts = tsdata(y, t0)

%% Test constructor 6

fs    = 1000;
nsecs = 10;
t     = linspace(0, nsecs-1/fs, nsecs*fs);
y     = randn(fs*nsecs,1);

ts    = tsdata(t,y,fs)

%% Test constructor 7

fs    = 1000;
nsecs = 10;
t     = linspace(0, nsecs-1/fs, nsecs*fs);
y     = randn(fs*nsecs,1);
t0    = time('14:00:00');

ts    = tsdata(t,y,t0)
ts    = tsdata(t,y,fs,t0)