function test_ao_split_samples()
% Test AO split method by samples.
%
% M Hewitson 02-03-07
%
% $Id: test_ao_split_samples.m,v 1.5 2008/09/19 14:03:50 ingo Exp $
%


%% make test ao
a1 = ao(plist('tsfcn', 'sin(2*pi*0.1*t)', 'nsecs', 100, 'fs', 10));

%% Make spectrum
a1xx = pwelch(a1);

%% Split by samples
samps = [1 100 101 300];

pl = plist(param('samples', samps));
b = split(a1, pl);
c = split(a1xx, pl);


%% Plot

iplot(a1, b)
iplot(a1xx, c)

b1 = b(1);
plot(b1.hist)


%% Recreate from history

% Write an m-file from AO
ao2m(b1, 'test.m');

% now run it
mc
a_out = test;

iplot(a_out)
plot(a_out.hist)
% END
