view m-toolbox/test/test_ltpda_linedetect.m @ 4:e3c5468b1bfe database-connection-manager

Integrate with LTPDAPreferences
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_LINEDETECT test script for ltpda_linedetect.
%
% M Hewitson 14-05-07
%
% $Id: test_ltpda_linedetect.m,v 1.14 2009/02/02 15:20:39 hewitson Exp $
%
function test_ltpda_linedetect()
  
  
  % Make test AOs
  
  nsecs = 10000;
  fs    = 10;
  
  pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*1.433*t) + 10*sin(2*pi*0.021*t) + randn(size(t))');
  x12 = ao(pl);
  
  % Make spectrum
  pl = plist('Nfft', round(1000*x12.data.fs'));
  x12xx = psd(x12, pl);
  
  % Detect lines
  pl   = plist('N', 100, 'bw', 256, 'hc', 0.9, 'thresh', 2.5);
  x12l = linedetect(x12xx, pl);
  
  % Plot
  ppl = plist('Markers', {'', 'o'}, 'LineStyles', {'', 'None'});
  iplot([x12xx x12l], ppl);
  plot(x12l.hist)
  
  
  %% Write an m-file from AO
  a_out = rebuild(x12l)
  
  iplot(a_out)
  plot(a_out.hist)
  
end
% END