view m-toolbox/test/test_ltpda_cpsd.m @ 19:69e3d49b4b0c database-connection-manager

Update ltpda_uo.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 ltpda_cpsd functionality.
%
% M Hewitson 13-02-07
%
% $Id: test_ltpda_cpsd.m,v 1.23 2009/04/07 17:45:22 ingo Exp $
%
function test_ltpda_cpsd()
  
  % Make test AOs
  
  nsecs = 10;
  fs    = 1000;
  pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))');
  
  a1 = ao(pl);
  a2 = ao(pl);
  
  % Filter one time-series
  % Make a filter
  pl = plist('type', 'bandpass', 'fs', 1000, 'order', 3, 'fc', [50 250]);
  f2 = miir(pl);
  
  % filter the input data
  [a3, f2] = filter(a1,plist(param('filter', f2)));
  
  % make some cross-power
  a4 = a3+a2;
  
  % Make CPSD
  a8 = cpsd(a1, a4);
  
  % Plot results and history
  iplot(a8);
  plot(a8.hist);
  
  % Reproduce from history
  a_out = rebuild(a8);
  
  iplot(a_out)
  plot(a_out.hist)
  
end